Which include file contains this function?
Thanks.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Anonymous
-
2005-11-29
Header files are plain text, a simple text search is a much quicker method of answering your question.
The symbol __fpurge does not exist in any of the headers included in the Dev-C++ package.
The prefix implies a non-standard system specific symbol. fpurge() exists in the GNU C library. MinGW/GCC does not use the GNU C library, it uses MSVCRT which does not include this function.
There are probably other ways of achieving what you need - what are you trying to do?
Clifford
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I am trying to clear memory buffer which collect keys from keyboard.If I use getchar() function to collect one character from keyboard, the next time I call getchar() it will get me <ENTER> '\n' or some other character.This characters is what I need to clear from memory buffer.
Someone would say to write several getchar() to clear it but I realy don't know how much characters are in buffer.In UNIX this buffer is cleared with __fpurge(stdin) function.
If you know the answer thanks.Zoran
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Anonymous
-
2005-11-30
fflush() is not defined for input streams in the standard library. However fflush() in the MSVCRT library used by MinGW is documented as working in input streams. However this will make the code non-portable (as would __fpurge). The simple solution:
Which include file contains this function?
Thanks.
Header files are plain text, a simple text search is a much quicker method of answering your question.
The symbol __fpurge does not exist in any of the headers included in the Dev-C++ package.
The prefix implies a non-standard system specific symbol. fpurge() exists in the GNU C library. MinGW/GCC does not use the GNU C library, it uses MSVCRT which does not include this function.
There are probably other ways of achieving what you need - what are you trying to do?
Clifford
I am trying to clear memory buffer which collect keys from keyboard.If I use getchar() function to collect one character from keyboard, the next time I call getchar() it will get me <ENTER> '\n' or some other character.This characters is what I need to clear from memory buffer.
Someone would say to write several getchar() to clear it but I realy don't know how much characters are in buffer.In UNIX this buffer is cleared with __fpurge(stdin) function.
If you know the answer thanks.Zoran
do a man fflush and check out the docs.
Mike
fflush() is not defined for input streams in the standard library. However fflush() in the MSVCRT library used by MinGW is documented as working in input streams. However this will make the code non-portable (as would __fpurge). The simple solution:
void purge_stdin()
{
while( getchar() != '\n' )
{
/ do nothing /
}
}
Alternatively in C++, use the istream object cin rather than stdio, and purge it by calling:
cin.sync() ;
Clifford
I've done a google search with the following keywords:
__fpurge include
It seems you must #include <stdio_ext.h>
If this doesn't work it is probably because it seems to be a Unix function in the first place.