File Handleing

Started by
3 comments, last by Klear 21 years, 11 months ago
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
Advertisement
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)...
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!


Wachar's Eternity <-<-<-<-<- Me own site!
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
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!


Wachar's Eternity <-<-<-<-<- Me own site!

This topic is closed to new replies.

Advertisement