|
-
Apr 6th, 2001, 10:58 PM
#1
Thread Starter
Addicted Member
Just wondering how you save a variable to a text file,
like say I had a variable called EnteredInformation, and it held all the information that a user entered into a form, how would I then put that into a text file??
Thanks
-|- Hurgh -|-
Email: [email protected]
Website: http://www.hurgh.org/
Unix, Linux, FreeBSD, OpenBSD, Solaris, Windows
C, C++, PHP, VB6, ASP, VBScript, JavaScript
-
Apr 6th, 2001, 11:00 PM
#2
Thread Starter
Addicted Member
Sorry and one other thing,
How would I then later get the information that I put into that text file and put it back into the variable??
Thanks Heaps
-|- Hurgh -|-
Email: [email protected]
Website: http://www.hurgh.org/
Unix, Linux, FreeBSD, OpenBSD, Solaris, Windows
C, C++, PHP, VB6, ASP, VBScript, JavaScript
-
Apr 7th, 2001, 03:53 AM
#3
Monday Morning Lunatic
Code:
#include <iostream>
#include <fstream>
#include <string>
using namespace std;
void main() {
string sText = "Hello!";
{
ofstream OutFile("myfile.txt");
OutFile << "Text: " << sText << endl;
}
{
ifstream InFile("myfile.txt");
InFile >> sText;
cout << sText << endl;
}
}
I think that should compile...you get the idea though
I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
-- Linus Torvalds
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|