Re: loading file from the disk


[ Follow Ups ] [ Post Followup ] [ CS1704 Discussion WWWBoard ] [ FAQ ]

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
use namespace std;

void main()
{
//this is input file stream called 'afile'
ifstream afile;
//string called 'astring'
string asting;

//opens file named "myfile.txt"
afile.open("myfile.txt");

//reads a string and puts in astring
afile >> astring;

//close file
afile.close();
}

something like that
its in cs1044 notes (or whatever)



Follow Ups:



Post a Followup

Name:
E-Mail:

Subject:

Comments:

Optional Link URL:
Link Title:
Optional Image URL:


[ Follow Ups ] [ Post Followup ] [ CS1704 Discussion WWWBoard ] [ FAQ ]