简体   繁体   中英

Read text from .txt file started from other line

How I can read text from file, but not from 1. line. For example in text file is written-

1| Hello
2| !
3| 2021
4| 18
5| 03

But I want that program read text from line number 3 (2021....), bet then read next line.

But how I could do it? C++

You can open the file using std::ifstream , use itsignore() method to skip the first 2 lines, and then use std::getline() to read the 3rd line.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM