answersLogoWhite

0


Best Answer

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.

User Avatar

Wiki User

10y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: What happens with the EOF or end of file condition?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Continue Learning about Engineering

What is ascii value of EOF?

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.


Explain in details about get char?

#include <stdio.h> The function getchar() returns an int corresponding to the next character in standard input. The value EOF indicates error or end-of-file.


What will happens to current when cable length increases?

With a constant voltage and increase in wire length will increase the end to end resistance and therefore the current will decrease.


7 Write a program to append one file at the end of another?

#include#includevoid main(){FILE *fp1,*fp2;char ch,fname1[20],fname2[20];printf("\n enter sourse file name");gets(fname1);printf("\n enter sourse file name");gets(fname2);fp1=fopen(fname1,"r");fp2=fopen(fname2,"a");if(fp1==NULLfp2==NULL){printf("unable to open");exit(0);}do{ch=fgetc(fp1);fputc(ch,fp2);}while(ch!=EOF);fcloseall();}


What is getchar function in c?

getc(FILE *stream), prototyped in stdio.h, reads the next character from stream and returns it, or returns EOF if an error occurs or end of file has been reached.getch(), prototyped in both conio.h and curses.h, performs a blocking-style hardware-based read of the keyboard. If no key is available, by default getch()will wait until a key is available. Options or functions usually exist to check to see if a key is available in the system keyboard buffer.getchar() is the same as getc(stdin).More information is available at the related links below, which apply to both Win32 and Linux/Posix systems.

Related questions

What is ascii value of EOF?

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.


What are the different types of files and how End Of File of a full represented by a pointer?

There are two file types in C++ namely, text file and binary file. In text file EOF or end of file is represented by an end of file character having ASCII 26. In binary files EOF or end of file is represented by NULL in the file pointer


How the end of file can be detected in c plus plus?

Use the istream::eof() method.


What is the return value of getch function?

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.


What is End-of-file data?

EOF or 'end-of-file' means the lack of (any more) data.EOF can be reported by:read returning 0getchar, getc returning -1fgets returning NULLetc


How do you detect an end of file in c plus plus?

The following code demonstrates how the end of file can be detected. Note that you do not test std::istream::eof() directly. The eof flag is only set when you read past the end of a file, not when you read the last character in a file. That is, if the file has three characters and you extract three characters, eof is not set at that point. It is only set when you attempt to read another character and there is no character there. At that point you are past the end of the file and the flag is set. #include<iostream> #include<fstream> int main() { char * filename = "test.txt"; // create a 3-character file std::ofstream outfile; outfile.open (filename, std::ios::out); outfile << "ABC"; outfile.close(); std::ifstream infile; infile.open (filename, std::ios::in); char ch; while (infile.get(ch)) { std::cout << ch; std::cout << "\tEOF flag is " << (infile.eof()?"":"not") << " set\n"; } std::cout << "EOF flag is " << (infile.eof()?" ":"not ") << "set\n"; infile.close(); }


How to use end-of-file in while loop?

eg: char linebuff [256]; FILE *f; ... while (fgets (linebuff, sizeof (linebuff), f) != NULL) { } if (ferror (f)) /* error */ else /* EOF */


Explain in details about get char?

#include <stdio.h> The function getchar() returns an int corresponding to the next character in standard input. The value EOF indicates error or end-of-file.


Which programming language can look ahead to determine that the end-of-file is going to be read next?

it is not actually looking ahead. the program should recognize the eof when it comes across. Example:while(Stream.Read()){// do something}


What happens when you change the doc at the end of a file to an mp3?

Nothing. You have simply changed the extension. That won't change the file format. To do that you need to convert the file with conversion software.


What happens if you eat a disposable nail file?

You could probably end up with some kind of disease or nothing at all. That's my guess.


What is the difference between line feed and carriage return?

Line Feed '\n' takes the cursor to newline but does not take it to the beginning. Wheareas the Carriage Return '\r' does just the opposite. The combination '\r\n' is used as EOF (End Of File). Note: Mac uses '\r' for Newline whereas Unix use '\n'.