Aug 13, 2010 at 4:17am Aug 13, 2010 at 4:17am UTC
Hey everyone, I was wondering if someone could take a quick look at my code because I have an error somewhere and I'm not sure exactly whats wrong with my code, any help would be greatly appreciated thanks!
btw, I'm trying to read two lines from a text file and write "GO" into file just so you don't get confused.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
int main()
{
ifstream rideIn;
char cometLine[6];
char ufoLine[6];
int cometSum,ufoSum;
rideIn.open("file.txt" );
if (rideIn.is_open())
{
rideIn.getline(cometLine,256);
cometSum = (lineTotal(cometLine,1,0)) % 47;
rideIn.getline(ufoLine,256);
ufoSum = (lineTotal(cometLine,1,0)) % 47;
rideIn.close();
}
ofstream rideOut;
rideOut.open("file.txt" ,ios::ate);
if (cometSum == ufoSum)
rideOut.write("GO" ,256);
rideOut.close();
system("Pause" );
return 0;
};
Last edited on Aug 13, 2010 at 4:20am Aug 13, 2010 at 4:20am UTC
Aug 13, 2010 at 7:36am Aug 13, 2010 at 7:36am UTC
What is the error youre getting?
Aug 13, 2010 at 12:49pm Aug 13, 2010 at 12:49pm UTC
okay cool thanks I'll try that out, i don't quite get the file streaming functions yet, thanks alot for the help ne555!
Aug 13, 2010 at 2:00pm Aug 13, 2010 at 2:00pm UTC
Yea it worked thanks alot for help!