How can I read in a specific number of characters from a line? (C++) : <p>I am working on a homework assignment where I need to error check the first line of a .txt file. In this case, the first line of the text file should read "Number of samples: ", followed by an unspecified number. If the line DOES NOT start with "Number of samples: ", I need to terminate the program after displaying an error message. Assuming that the line DOES start with the proper string, I need to read in the number as an unsigned integer. </p>

<p>In summary, I need to read in 19 characters from a .txt file line. How do I go about doing that, while still being able to read in the rest of the line to store it as a variable?</p>

<p>The libraries I'm using are iostream, string, ofstream, and ifstream if that matters.</p>
