How to get the line number from a file in C++?

后端 未结 4 1422
借酒劲吻你
借酒劲吻你 2021-02-02 01:15

What would be the best way to get the line number of the current line in a file that I have opened with a ifstream? So I am reading in the data and I need to store

4条回答
  •  小鲜肉
    小鲜肉 (楼主)
    2021-02-02 01:51

    From an ifstream point of view there is no line number. If you read in the file line by line, then you just have to keep track of it yourself.

提交回复
热议问题