topdawgg19
Programmer
Alright I doubt anyone will be able to figure this one out... My program gets stuck right after I read in all the information from the file. The output screen never shows anything past
while (! program_in.eof() )
{
program_in.getline (source,100);
cout << source << endl;
}
Anotherwords, if I put in a cout<<"I HATE THIS PROGRAM"<<endl right after the previous set of lines above... it will not print this to my screen. But the above lines do give me the contents of source. Now for the fun part, if I run the debugger to this line: while (source[start]!=EOF); it shows that source[start]= a which is correct. Any ideas??
==========================================================
int main()
{
char file_in[250]="c:/Documents and Settings/All Users/Desktop/input.txt";
//cout<<"Enter the Input File "<<endl;
//cin>>file_in;
ifstream program_in(file_in,ios::in); //sets file for input
if(!program_in) //checks to see if file exists
{
cerr<<"File Not Found"<<endl;
exit(1);
}
int i=0;
while (! program_in.eof() )
{
program_in.getline (source,100);
cout << source << endl;
}
program_in.close();
cout<<endl<<"hello";
while (source[start]!=EOF);
{
lexer();
cout<<token<<" "<<lexeme<<endl;
}
return 0;
}
while (! program_in.eof() )
{
program_in.getline (source,100);
cout << source << endl;
}
Anotherwords, if I put in a cout<<"I HATE THIS PROGRAM"<<endl right after the previous set of lines above... it will not print this to my screen. But the above lines do give me the contents of source. Now for the fun part, if I run the debugger to this line: while (source[start]!=EOF); it shows that source[start]= a which is correct. Any ideas??
==========================================================
int main()
{
char file_in[250]="c:/Documents and Settings/All Users/Desktop/input.txt";
//cout<<"Enter the Input File "<<endl;
//cin>>file_in;
ifstream program_in(file_in,ios::in); //sets file for input
if(!program_in) //checks to see if file exists
{
cerr<<"File Not Found"<<endl;
exit(1);
}
int i=0;
while (! program_in.eof() )
{
program_in.getline (source,100);
cout << source << endl;
}
program_in.close();
cout<<endl<<"hello";
while (source[start]!=EOF);
{
lexer();
cout<<token<<" "<<lexeme<<endl;
}
return 0;
}