title: Can I make ungetc unblock a blocking fgetc call?
body: <p>I would like to stuff an 'A' character back into stdin using ungetc on receipt of SIGUSR1.  Imagine that I have a good reason for doing this.</p>
  
  <p>When calling foo(), the blocking read in stdin is not interrupted by the ungetc call on receipt of the signal.  While I didn't expect this to work as is, I wonder if there is a way to achieve this - does anyone have suggestions?</p>
  
  <pre>
  void handler (int sig)
  {
    ungetc ('A', stdin);
  }
  
  void foo ()
  {
    signal (SIGUSR1, handler);
  
    while ((key = fgetc (stdin)) != EOF)
    {
      ...
    }
  }
  </pre>