MIPI_BaseC_WebinarFRTK/26_Seminar13/01_errors_p6.c

29 lines
554 B
C
Raw Normal View History

2024-11-13 09:22:28 +03:00
#include <stdio.h>
#include <conio.h>
#define N 3
int main(int argc, char **argv)
{
FILE *open;
char name[] = "temperature_small1.csv";
open = fopen(name, "r");
if(open==NULL)
return 1;
int Y,M,D;
int r;
while((r = fscanf(open, "%d;%d;%d",&Y,&M,&D))>0)
{
printf(".");
if(r<N)
{
char s[20];
r = fscanf(open, "%[^\n]", s);
printf("ERROR %d=%s\n",r,s);
}
else
printf("%d = %d;%d;%d\n", r,Y,M,D);
}
fclose(open);
return 0;
}