I want to read from two files, one containing floats in three columns, and another containing ints in two columns. I have the following code to read from stdin:
int main() { while (scanf("%lf %lf %lf\n",&x,&y,&z) != EOF) { // do stuff } puts("foo"); int a,b; while (scanf("%d %d\n",&a,&b) != EOF) { puts("bar"); } } Then I call the program with cat ortho.dat pairs.dat | ./angles, ortho.dat and pairs.dat being the two files. However the output is just foo indicating that the second file is never read, presumably because it reads EOF and immediately terminates the second loop. Is this correct?
How could I read the two files, without actually opening them in the program, merely reading them from stdin?
cat. 3. Read those files - that depends on the programming language