#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
int main(int argc, char **argv) {
int o;
int w = 80;
int p = 1;
int c;
int line_count = 0;
long remember_pos;
while ((c = getc(stdin)) != EOF) {
long num = ftell(stdin);
printf("%li\n", num);
}
}
Basically processing the standard input when you do it in unix, like for example
$ gcc -Wall fileabove.c
$ echo hello | ./a.out
1
2
3
4
5
6
I want it to process the 'hello' from echo. I want there to be a way to get to stdin[0] (in file's with fseek). Also get the position we are currently on (in file's with ftell)
OR looking for any other way to keep track of unseekable standard input