fscanf and it's use in filtering through text
I'ld first like to thank everyone on this site for their contributions, it's actually allowed some of my hair not to be pulled out this time around.
I am trying various approaches (since they keep failing) to have my program scan through a file that has dates scattered about in it. First attempt tried making two arrays of date desired and date found and then use strcmp. Since it's been a while with handling data types, I believe it's comparing numbers to ascii despite my best efforts to convert them (c=c-48 ... but I bet it's still ascii #!)
So I am trying scanf, which I never learned. Testing with human input, scanf("%d", &dtest) reports 12 if I enter 12/. However, will this keep going in a file that has mm/dd/yyyy? My printf debugger shows it's not, but it keeps crashing on me.
TL;DR: the date format is mm/dd/yyyy
Will fscanf in a file skip past the 2nd / and keeps on going if I tell it scanf(fread, "%d", &found); ? Is there a way to tell a scanf to stop if another data type is found or after a 2nd or 3rd character?
I can add the codes I have right now, but they're so amateurish it's embarrassing. In brief the main part:
Int c; /*char?*/
fscanf(fread, "%d", &found);
fscanf(fread, "%d", &dtest);
/*assuming it stopped at the / and i need to verify that it's 2012*/
if (strcmp(found, dtest)==0)