Click to See Complete Forum and Search --> : C Question


MrNewbie
12-11-2000, 02:15 PM
In C, how would I have a section in a program to get a user to enter some text, like their name, address, telephone number etc, then have it stored in a flat file, then have another option to display the details that are entered and have it read them from the file and print them on screen? Preferably one persons details then press a key and you get the next persons details.
Would it be hard?
Thanks You
MrNewbie

f'lar
12-11-2000, 06:37 PM
Sequential access only? All new records added to the end?

MrNewbie
12-11-2000, 06:39 PM
Yeah!
MrNewbie

f'lar
12-11-2000, 06:42 PM
I could give you the c++ version, but I don't know exactly how to do it in C only.

tnordloh
12-11-2000, 06:45 PM
It would be easy. You're talking about creating your own database, basically. I assume you're talking about having many records stored in the file, and being able to bo back and forth through them and such. In fact, I created a program almost exactly like this a short time ago. I suggest creating the program you want to make in stages. First set up a program that stores the information you want in a struct, then get that struct to write to a file. You can take a look at the file, and make sure it looks cool. If you like it, create the print function you want to make.

Basically, what I'm saying is to break your program into small chunks, and do what you can. when you come to a stopping point, ask where to go next. The question you're asking right now would involve writing actual code and such.