Archived

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

Klear

File Handleing

Recommended Posts

Is there a reference online where I can read up on file handleing? I am creating a address book and I want to save all my contacts to a dat file or something. I also want to be able to call up contacts to be viewed. Thanks

Share this post


Link to post
Share on other sites
Sounds like you only need a simple text-based file format => simple fprintf() / fscanf() should do quite well...

If you want an advanced solution, then think about using XML - there are some nice and easy to use parsers available (Xerxes for example)...

Share this post


Link to post
Share on other sites
What language are you using? For C++, I recommend fstream(library). For output you would make an output object, like so: ofstream outdata//o in ofstream for ''output'' ** outdata can be anything!

outdata("file1.dat") //blah

Like so. Or for input:

ifstream indata//anything for indata acceptable

indata("file1.dat")

Although this way is my favorite, I''ve heard of other ways of file handling in C++.



What does it take to be a good game programmer?
---
Good insight,
good knowledge,
and of course,
big money deposits!



Share this post


Link to post
Share on other sites
What would I use to pull out a block of data? Like, I only want to display a contact at a time... Should I use ''read'' or ''readsome'' from the fstream? And how would I code it so it finds the contact and its info. that the user desires to view?

Thank You

Share this post


Link to post
Share on other sites
I''m not sure, but I''ve heard of another way that does exactly what you''re wanting to do. Sorry about not being able to help, but you might want to do a search.



What does it take to be a good game programmer?
---
Good insight,
good knowledge,
and of course,
big money deposits!



Share this post


Link to post
Share on other sites