Menu

__fpurge

2005-11-29
2012-09-26
  • Nobody/Anonymous

    Which include file contains this function?
    Thanks.

     
    • Anonymous

      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

       
    • Nobody/Anonymous

      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

       
    • Nobody/Anonymous

      do a man fflush and check out the docs.

      Mike

       
    • Anonymous

      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:

      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

       
    • Nobody/Anonymous

      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.

       

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.