how do you read a text file from justa certain line???
Ex.
Question:
[question here]
Answer:
[answer here]
How do I read just the answer line??
Thanks in advance
how do you read a text file from justa certain line???
Ex.
Question:
[question here]
Answer:
[answer here]
How do I read just the answer line??
Thanks in advance
You could read the file in line by line, loading each line into a temp string variable, then use strcmp to check for "Answer:". Once you find it, read in the next line and populate your answer variable with that data.
If your file is of standard field widths, then using fseek() might work too. If, as in most files, that isn't the case, then it's hunting time, like jdinger recommends.
could somebody give me an example on how to do it with strcpy()