I need some tutorials on reading/writing from a file

Started by
1 comment, last by Ekim_Gram 20 years, 8 months ago
I''m trying to make an address book or hangman or something but those all require reading and writing from a file. Can somebody point me in the right direction for that? I''ve got the C++ Programming Language but I haven''t read that part yet of streams and I/O. There''s no town drunk here, we all take turns. Velocity Gaming Force
Advertisement
There are many ways to read from a file, it depends on the situation.

In your examples of an address book, a database would actually be more desireable. For a nice free one, look into MySQL.

And if you have a book (That''s what I assume you meant by "I''ve got the C++ Programming Language". You didn''t actually mention a book, just hinted at it by using a verb associated with books), but haven''t read the section on file I/O yet, then why are you here? Generally, one exhausts their resources on hand trying to find the solution themselve before they come here as a last resort.

In C, look up FILE, fopen, fscanf, fprintf, and fclose
In C++, look up ifstream and ofstream (stands for ''in file stream'' and ''out file stream'', not ''if stream'' and ''of stream'').

Do you use your powers for good or for awesome?
My newly updated site | The Cutter Project | Association of Computing Machinery

[Formerly "capn_midnight". See some of my projects. Find me on twitter tumblr G+ Github.]

There is one here on gamedev, check it out:

http://www.gamedev.net/reference/articles/article707.asp

This topic is closed to new replies.

Advertisement