Visit Jeremy's Blog.
Go Back > Forums > Non-*NIX Forums > Programming
User Name
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.


  Search this Thread
Old 04-15-2005, 01:09 AM   #1
LQ Newbie
Registered: Mar 2005
Posts: 4

Rep: Reputation: 0
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???
Old 04-15-2005, 01:43 AM   #2
Registered: Apr 2005
Location: Russia, Saint-Petersburg
Distribution: Slackware 10
Posts: 109

Rep: Reputation: 15
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


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
BASH script Ė reading and writing variables to a separate file morrolan Programming 10 09-20-2005 08:45 AM reading and writing to a text file simultaneously mrobertson Programming 3 09-08-2005 01:30 PM
C File reading and writing AbhishekSamuel Programming 3 05-03-2005 04:59 PM
Reading and Writing DVD media elsabio Fedora 2 03-06-2005 07:25 PM
reading / writing OpenOffice files. G™utama Programming 1 11-04-2003 07:46 AM > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 05:52 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration