Click here to Skip to main content
15,885,985 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am working on an application that should read a text file which contains the path of the .jpg files using C file handling functions.
The requirement is to read the file line by line but if the path of the line is wrong, it should not read the current line any more and should move into the next line.

Can any one plz help me how to move the file pointer to the next line while it is in the current line. Thank you
Posted
Comments
OriginalGriff 22-May-14 14:22pm    
What have you tried?
Where are you stuck?
Member 10834545 23-May-14 1:02am    
I didn't stuck anywhere..if any one of the path in my file is wrong..then it has to move to next line(path)..

1 solution

http://www.cplusplus.com/reference/cstdio/fgets/[^]
Set the second character to 0 if you discard the contents anyway.

There's one function to set the function pointer to a specific position: fseek(). However, you need to know the exact position or offset from the current position (in bytes) to use this function. If you don't have that, then the only way is to keep on reading and discard the results.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900