Archived

This topic is now archived and is closed to further replies.

gavrhen

Any good sites of File Saving/ Loading

Recommended Posts

Hey everyone, I''am trying to figure out how to save a linked list and man is it killing me. If anyone can tell me the source code or a good site on file saving and loading it would really help. Stand Tall and Shake the Heavens!

Share this post


Link to post
Share on other sites
Which bit are you finding hard?

I would do something like this:

open file

iterate through list
for each element
-write data fields to file

close file

to reload it:

open file

create element
read fields from file to element
add element to list
check for end of file
if yes - terminate list
if no - goto create element...

close file

-DeVore

Share this post


Link to post
Share on other sites
It would also be wise to save the number of items, so that you don''t try to load in data that''s beyond the boundaries of the file. But yes, DeVore has it all written down.

For simple file i/o functions, look at fopen, fwrite, fread, and fclose in the MSDN.

Share this post


Link to post
Share on other sites