EOF(END OF FILE) *The eof () function is used to check the end of the stream occurred or not. *The eof () returns 1(true) when the end of the file occurred otherwise 0(false). *It is mostly used with input stream object while reading data from file.
example
OUTPUT:
PEEK: *Returns the next character in the input sequence, without extracting it: The character is left as the next character to be extracted from the stream . *Return Value: It returns the ASCII value of the character if successful, or EOF (-1) if the end-of-file is reached. *No Parameters: Unlike some other input functions, peek() doesn't require any parameters. It operates solely based on the current state of the input stream.
EXAMPLE:
OUTPUT:
PUTBACK() You can return the last character read from a stream to that stream by using putback( ). Its prototype is istream.putback (char c); where c is the last character read.
EXAMPLE 1
EXAMPLE 2
FLUSh () When output is performed, data is not necessarily immediately written to the physical device linked to the stream. Instead, information is stored in an internal buffer until the buffer is full. Only then are the contents of that buffer written to disk. However, you can force the information to be physically written to disk before the buffer is full by calling flush( ).