https://github.com/Kitware/CMake
Raw File
Tip revision: e3185e3d1b92a95c18f22f70b3cef6944dd019eb authored by Brad King on 20 March 2020, 10:26:14 UTC
CMake 3.17.0
Tip revision: e3185e3
print_stdin.c
#include <stdio.h>

int main()
{
  char buf[1024];
  size_t nIn = sizeof(buf);
  while (nIn == sizeof(buf)) {
    nIn = fread(buf, 1, sizeof(buf), stdin);
    if (nIn > 0) {
      size_t nOut;
      nOut = fwrite(buf, 1, nIn, stdout);
      if (nOut != nIn) {
        return 1;
      }
    }
  }
  return 0;
}
back to top