You can use std::getline
from the <string>
header to read a line into a std::string
.
Put that in a loop to read lines until you encounter one that starts with the “specific word”, or reading failed.
If line found, display that line.
Sub-task: find out how to check whether a std::string
starts with a specific word.
0
solved How can I read only a single line from text file which contains multiple lines? [closed]