':'
/* Source Code to read a text of string from a file. */ #include <stdio.h> #include <stdlib.h> /* For exit() function */ int main() { char c[1000]; FILE *input; if ((input = fopen("time.in","r"))==NULL){ printf("Error! opening file"); exit(1); /* Program exits if file pointer returns NULL. */ } fscanf(input,"%[^\n]",c); printf("Data from file:\n%s",c); fclose(input); return 0; }
int hour, min, sec; fscanf( input, "%ld:%ld:%ld", &hour, &min, &sec);
%ld
int
if (fscanf(...) != 3) { /* handle error...*/ }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)