It's -1, but in theory could be something else on some exotic platforms, but still negative. See the related links below for further information.
There is no ascii value for EOF. The constant EOF is a special value, not representing any character, but indicating an eof-of-file or error condition when using stream I/O. On the other hand, there is an ascii charactor end-of-file, <CTRL>Z, 26, or 0x1A which, in the DOS era, indicated the end of file in a text file, but this is not the same as the run-time library constant EOF.
Random example: while ((c= getchar()) != EOF) putchar (c);
In C++ EOF is a special function which will return nonzero when there is no more data to be read. In C++ nonzero means true, the alternative to nonzero is zero which means false.
Of course we do, 'FILE' and 'EOF' for example are all capitals.
Ctrl+Z mean EOF in WinDos, no matter what programming language you are using.
There is no ascii value for EOF. The constant EOF is a special value, not representing any character, but indicating an eof-of-file or error condition when using stream I/O. On the other hand, there is an ascii charactor end-of-file, <CTRL>Z, 26, or 0x1A which, in the DOS era, indicated the end of file in a text file, but this is not the same as the run-time library constant EOF.
Random example: while ((c= getchar()) != EOF) putchar (c);
It returns an int, representing a character. (Basically, chars are ints.) However, if EOF (End-Of-File) has been read, it will return EOF (-1) and set the eof error flag accordingly.
In C++ EOF is a special function which will return nonzero when there is no more data to be read. In C++ nonzero means true, the alternative to nonzero is zero which means false.
Use the istream::eof() method.
Of course we do, 'FILE' and 'EOF' for example are all capitals.
#include <stdio.h> main() { FILE *fd; int c; fd= fopen("./file.c","r"); while ( (c=fgetc(fd)) != EOF) { printf("%c", c); } fclose(fd); }
Ctrl+Z mean EOF in WinDos, no matter what programming language you are using.
int count_whitespace (FILE* input) { int c, count=0; while (( c = getc(input) ) != EOF ) if ((char) c==' ') ++count; return count; }
#include <stdio.h> #include <ctype.h> ... int caps = 0; int c; file = fopen ("InputFile", "r"); while ((c = fgetc (file)) != EOF) { if (isupper (c)) ++caps; } fclose(file); ...
the answer is that c is double the value of b
The ASCII value for "C" is 67, for "c", 99.