M
muser
I have a logical error in my program, I have submitted the program and
my tutor hasn't listed the other problems with the code, but said that
the program won't run because of a while statement.
The while statement is as follows.
while(infile.peek() != EOF)
{
infile.getline(temp1, max);
};
if statement
if statement
if statement
etc.
The code compilers ok, but the program won't run because (tutor's
explaination)
it is going to the end of the file and reading nothing.
I've tried enclosing all other statements within the while statement,
but that appears not to work. Like so:
while(infile.peek() != EOF)
{
infile.getline(temp1, max);
if statement
if statement
if statement
etc.
};
If anyone could help I would be extremely grateful.
my tutor hasn't listed the other problems with the code, but said that
the program won't run because of a while statement.
The while statement is as follows.
while(infile.peek() != EOF)
{
infile.getline(temp1, max);
};
if statement
if statement
if statement
etc.
The code compilers ok, but the program won't run because (tutor's
explaination)
it is going to the end of the file and reading nothing.
I've tried enclosing all other statements within the while statement,
but that appears not to work. Like so:
while(infile.peek() != EOF)
{
infile.getline(temp1, max);
if statement
if statement
if statement
etc.
};
If anyone could help I would be extremely grateful.