1

I've tried include and include"studio.h". Compiler says eof not declared in this scope.

I have if(infile.peek()==eof())

I

Alex
  • 121
  • 9

1 Answers1

1

You'don't better refer to the following thread: How does ifstream's eof() work?

In C you should include stdio.h and use EOF constant.

#include "stdio.h"
....
if (getc()==EOF){...}

Or use this reference for C++: cstdio

#include <cstdio>
#include <iostream>
...
 if(infile.peek()==infile.eof())
Community
  • 1
  • 1
Robert Navado
  • 1,168
  • 7
  • 14