Buffer Concept fflush() flushall() getch()


Buffer Concept

Temporary storage area is called buffer.

All standard IO devices contain temporary memory those are called standard IO buffer.

In implementation when we are passing more than required number of elements then automatically remaining all values are stored in standard input buffer and these values automatically will pass to next input functionality.

In implementation when we required to remove the data from standard input buffer then recommended to go for flushall() or flush() function.

Flushall()

It is a predefined function which is declared in studio.h by using this function, we can delete the data from standard input buffer.

Flushall() function doesn't return any value.

FFlush()

It is a predefined function which is declared in studio.h by using this function we can clear the data from standard input buffer.

Fflush function requires 1 argument of type FILE* and returns void type data.

Getch()

It is predefined unformated function which is declared in conio.h by using this function we can read a character directly from keyboard.

getch() function returns an integer value i.e. ACII value of input character.

Comments