#include<stdio.h>
// use line f = fopen ("test.txt", "wb"); and open the file
// in notepad: no new lines! But if you open it in visual C's editor, you see
// new lines. (\n is really two characters: one goes to the next line but
// at the same location as the line above it, and another one goes to the
// beginning of the new line).
// Now change "wb" to "w" to write in ASCII instead of binary
void main ()
{
char matn[1024];
char str[80];
int i;
FILE *f;
f = fopen ("test.txt", "r");
if (!f) { // f==NULL
printf("Cannot open test.txt for writing.\n");
return;
}
//fprintf(f, "1 2\n3\t6");
while (!feof(f)) {
fscanf(f, "%d", &i);
printf("%d\n", i);
}
fclose(f);
}