Read a file, doubt!!!
Hello,
Can I read a file line by line??? lseek is to random access file, but I am interesting in read file line by line. Best regards. |
What language?
In many languages, including BASH, the command is "read". |
Sorry, in a C programm.
Best regards |
In your C library, isn't there something like stdio?
If I recall correctly, there's a lib function named "read"--or maybe "readline" Never mind---this just in from Uncle Google: http://www.mrx.net/c/readfunctions.html |
In C it has function readline, ah you must notice what type file saving, binary or txt
|
You can use fgets() :
Code:
char * fgets (char *buffer, int max_size, FILE *file_to_read) fgets returns a NULL pointer if it fails, otherwise it returns a pointer to the beginning of the buffer. |
Finally, I do it with fgets.
Thanks a lot. |
All times are GMT -5. The time now is 04:24 PM. |