data is being read from a txt file with this format
Meet the Fockers,12345678918,04/19/2005,116
Meet the Parents,PG,03/06/2001,108
Fantastic Four,PG-13,07/10/2005,99
Harry Potter: Prisoner of Azkaban,Not-Rated,11/23/2004,142
Hitch,PG-13,07/02/2005,103
lets say if length is > than 3 digits or a negative number is in the input file then it would print invalid.. how would i go about doing that.. i tried changing char length[50] to int length and changed to %d in fscanf but then the displayed weird numbers when i printed it for testing...
Code:
typedef struct {
char title[50];
char rating[50];
char date[50];
char length[50];
} Videos;
---------------
fscanf(in_file, "\n%50[^,],%50[^,],%50[^,],%s",movies[i].title, movies[i].rating,movies[i].date,&movies[i].length);