On Fri, Sep 16, 2016, at 12:26 PM, u...@netbeisser.de wrote: > > #include <errno.h> > > #include <stdio.h> > > > > int main() > > { > > const int page_size = 22; > > int count = 0; > > int ch; > > FILE *tty; > > > > if ((tty = fopen("/dev/tty", "a+")) == NULL) > > return(errno); > > > > ch = getchar(); > > while (ch != EOF) { > > putchar(ch); > > if (ch == '\n') { > > ++count; > > if (count >= page_size) { > > fgetc(tty); > > count = 0; > > } > > } > > ch = getchar(); > > } > > fclose(tty); > > } > > hm, do you really need errno ?
Well, I don't know. Like I wrote, I am not an expert C programmer. I could just return a value of 1, but the user might be interested to know what the error was.