LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   Help reading and writing to file (https://www.linuxquestions.org/questions/programming-9/help-reading-and-writing-to-file-313422/)

xiste 04-15-2005 12:09 AM

Help reading and writing to file
 
Hi, I am new with C++. I need to wriet a programme that saves some data in a file, and when it starts, it reads that data, and stores it in a LinkedList. I dont know how to read this data from the file and save it in a LinkedList. I had been thinking about separating each field with a ' ; ', but then it woub be very tedious to be checking for ' ; ' . Anybody got any ideas???

Nad0xFF 04-15-2005 12:43 AM

if file is text - you can read it line per line with fgets (man fgets). If file is binary - you can use fread. Make cycle, while there is not end of file - read some data and add it to linked list


All times are GMT -5. The time now is 03:16 AM.