How do I create a program that creates a file that stores the variables data?

Please support our C++ advertiser: Intel Parallel Studio Home
Thread Solved

Join Date: Dec 2008
Posts: 29
Reputation: vandenzergen is an unknown quantity at this point 
Solved Threads: 0
vandenzergen's Avatar
vandenzergen vandenzergen is offline Offline
Light Poster

How do I create a program that creates a file that stores the variables data?

 
0
  #1
Dec 7th, 2008
I'm having a problem on how to create a program on c++ that creates its own file and storage capabilities. I'm planning to have an interface like this so I put a little detail about the program just to give you the idea of what I actually mean... it goes like this...

Menu

1. Create Profile
2. Search Listed Profiles
3. Search Details
4. Exit

That is a simple interface but what drives me crazy is on how to save the data that was stored in the variables. I've already used array technique but every time I shut the program, I could never access those data again if I choose the #2 option which is the "Search Listed Profiles" and #3 option which is the "Search Details". Is there anyway that I could do just to make that program work the way that I want it to be? I mean, the capabilities of such program that I'm dreaming of. I'm trying to copy the capabilities of a Database software.
Reply With Quote Quick reply to this message  
Join Date: Nov 2008
Posts: 106
Reputation: sid78669 is an unknown quantity at this point 
Solved Threads: 4
sid78669's Avatar
sid78669 sid78669 is offline Offline
Junior Poster

Re: How do I create a program that creates a file that stores the variables data?

 
0
  #2
Dec 7th, 2008
For this you will need to open file in append mode. this way you will be able to read the data in the file as well as add new data at the end.

  1. fopen("fileName", "a");

Also see this page: File Operations using fopen
Live free.... Die Hard!
Reply With Quote Quick reply to this message  
Join Date: Aug 2005
Posts: 15,357
Reputation: Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute 
Solved Threads: 1463
Team Colleague
Featured Poster
Ancient Dragon's Avatar
Ancient Dragon Ancient Dragon is offline Offline
Still Learning

Re: How do I create a program that creates a file that stores the variables data?

 
0
  #3
Dec 7th, 2008
In c++ you could use the fstream functions
Don't PM me with questions -- you might get a nasty PM in response. If you have a question then post it in one of the forums.
Reply With Quote Quick reply to this message  
Join Date: Dec 2008
Posts: 29
Reputation: vandenzergen is an unknown quantity at this point 
Solved Threads: 0
vandenzergen's Avatar
vandenzergen vandenzergen is offline Offline
Light Poster

Re: How do I create a program that creates a file that stores the variables data?

 
0
  #4
Jan 4th, 2009
Thanks everyone...
Reply With Quote Quick reply to this message  
Reply

This thread has been marked solved.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC