Code :
#include <stdio.h> int main(int nb, char * argv[]) { int vec[3], ch; FILE * in = fopen("mat.txt", "r" ); if (in) { while ((ch = fgetc(in)) != '{' && ch != EOF); while (fscanf(in, " {%d,%d,%d}", vec, vec+1, vec+2) == 3) { fprintf(stderr, "%d %d %d\n", vec[0], vec[1], vec[2]); } fclose(in); } else perror("mat.txt" ); return 0; }
|