Skip to main content
gamedev.net
🔒 Locked

File I/O using C++

Started by NoobProg 2 replies 500+ views
Original Post
NoobProg
NoobProg
Hey all... I suppose this topic has appeared for the nth time in this forum, but I had problems finding the correct topic to find the answers. So here goes: If I wish to be able to create a file to store records in it, display it on the screen, also able to search for a particular record to edit or to delete it, how do I go about doing it? Any help would be great! Sorry again if this topic has appeared yet again, maybe someone can point me to the right post?
Ezbez
Ezbez
[google]? Seriously, you know all the terminology, just seach for it. Sometimes it can be hard to search for something that you don't know anything about, but you've got all the good words to search for on google ("file IO C++" in this case), and there's lots of good resources out there.
NoobProg
NoobProg
Well...

I don't know, it could be the way I search for it, but the results that turned up were not exactly what I was looking for, so that's why I am asking in this forum, hoping that someone would help me out.

Thx

ApochPiQ
ApochPiQ
Google search for "File I/O C++".

The top ten hits are all passable tutorials for the C++ file I/O classes. There's even an article listed from GDNet. I don't understand how this can possibly qualify as "not exactly what you were looking for" - unless your requirements are a bit too strict.

Please correct me if I'm wrong here, but I get the impression that you want code to solve your particular precise situation. That ain't gonna happen. There are plenty of people here who will be more than willing to help out, but we expect to see some effort on your part.


You've already got your requirements spelled out fairly well: you have some data records, you want to store and retrieve those from disk, list them out on screen, and do searches. You in fact have five different problems to solve: organizing your data records; file I/O for storing records on disk; displaying a set of records on screen; modifying and deleting records; and searching a set of records.

Concentrate on solving one problem at a time. Since everything depends on your records, figure out how to store them in memory first. Get some simple code going that can store records and sets of records.

The next logical one to attack would be displaying them on screen, so you can see what you're doing. Once that's done, add the edit/delete capabilities. Finally, throw in the file I/O part at the end.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.