Getting input data and saving it for next time program runs

I would like to know how you could get data from a user and then save it to a .txt file, and then load it back into a program. Would you have to make 2 different source code files, one to write the file and then one to open it?
Last edited on
You can use file streams to read/write

http://www.cplusplus.com/doc/tutorial/files/
You can make one file for writing, and one for reading, or put both functions into the same file.
So what if I made a function that takes data and puts it into a file, and then another function that reads the data?
It would have to take input as long as the data type was null.

i.e.

[code]string x;

while (x==0){
//function to input data into .txt

}/code]
P.S how do you make it look like code?
Topic archived. No new replies allowed.