I want to read and print the first two lines from a text file. Problem is, I get the error: error c2059: syntax error: constant and it points to the first line in my text file. Any ideas?
The file.txt:
5
5
3
1 1 1 0 0
0 1 0 0 1
0 1 0 1 0
1 0 1 0 1
1 1 0 1 1
The code:
#include <stdio.h>
#include <stdlib.h>
int main() {
FILE *fp;
int line, col, gen;
fp = fopen("file.txt", "rt");
fscanf(fp, "%d\n,%d\n", &line, &col);
printf("line: %d, col: %d\n", line, col);
fclose(fp);
return 0;
}