Posted by HR on July 16, 2000 at 15:58:42:
In Reply to: loading file from the disk posted by dumb on July 16, 2000 at 15:37:46:
: how do you load a file from the disk?
hope i don't get in truble for pasting code :p
(i shouldn't though.. since its on text and stuff anyways)
#include void main() //opens file named "myfile.txt" //reads a string and puts in astring //close file something like that
use namespace std;
{
//this is input file stream called 'afile'
ifstream afile;
//string called 'astring'
string asting;
afile.open("myfile.txt");
afile >> astring;
afile.close();
}
its in cs1044 notes (or whatever)