fork download
  1. #include <stdio.h>
  2. #include <unistd.h>
  3. int getchax(void); /* changed the name intentionally */
  4. int main()
  5. {
  6. getchax();
  7. return 0;
  8. }
  9. /* getchar: simple buffered version */
  10. int getchax(void)
  11. {
  12. static char buf[BUFSIZ];
  13. static char *bufp = buf;
  14. static int n = 0;
  15. if (n == 0) { /* buffer is empty */
  16. n = read(0, buf, sizeof buf);
  17. bufp = buf;
  18. }
  19. return (--n >= 0) ? (unsigned char) *bufp++ : EOF;
  20. }
  21.  
  22.  
Success #stdin #stdout 0.01s 1680KB
stdin
anyinputiwant12345
stdout

Standard output is empty