Re: My ifstream won't work


[ Follow Ups ] [ Post Followup ] [ CS1044 Web Discussion Board ] [ FAQ ]

Posted by GiantLeap on September 22, 2001 at 12:21:18:

In Reply to: My ifstream won't work posted by Patrick Kelly on September 22, 2001 at 10:41:11:

: For some reason i can't take data from my file using the basic ifstream >> stuff, all i'm getting is zeroes. If you know what's wrong please help me here. When i say ifstream, i mean my datafile stream. It does work with getline function so i am totally confused.

Don't forget:
#include

//In is the name we will use to read from
//our file. The 'In' is the ifstream identifier.
ifstream In ( dataFile.c_str() );

//All of C++ is case sensitive!
In >> var1 >> var2;

...var1 and var2 of course being of the type of data being read (i.e. integers).


Follow Ups:



Post a Followup

Name:
E-Mail:

Subject:

Comments:

Optional Link URL:
Link Title:
Optional Image URL:


[ Follow Ups ] [ Post Followup ] [ CS1044 Web Discussion Board ] [ FAQ ]