How to read one row from a file in c++?

I have this text file:

0 // initial state

B 0 0 0 0 B // initial cell values on tape

0 0 0 0 R // move right

0 1 0 1 R // move right

0 B 1 B L // when a blank at the right is found, change to state 1 and move left

1 0 0 1 R // if a 0 is changed to 1, change to state 0 and move right

1 1 1 0 L // if a 1 is changed to 0, move left

1 B 0 1 H // if a B is changed to 1, stop

-1 // end of action table

6 // initial position of read/write pointer

I want to know how I can read just the second line of the file as char? Because I need to pass that specific line into a function.
Call getline() once, to read line 1 (but don't use the result)
Call getline() again, to read line 2, then pass that buffer to your function.

http://www.cplusplus.com/reference/string/string/getline/
http://www.cplusplus.com/reference/istream/istream/getline/
Topic archived. No new replies allowed.