LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
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.

Notices


Reply
  Search this Thread
Old 04-15-2005, 12:09 AM   #1
xiste
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, 12:43 AM   #2
Nad0xFF
Member
 
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
 
  


Reply



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 07:45 AM
vb.net reading and writing to a text file simultaneously mrobertson Programming 3 09-08-2005 12:30 PM
C File reading and writing AbhishekSamuel Programming 3 05-03-2005 03:59 PM
Reading and Writing DVD media elsabio Fedora 2 03-06-2005 06:25 PM
reading / writing OpenOffice files. Gªutama Programming 1 11-04-2003 06:46 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 02:20 PM.

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