Skip to content

Instantly share code, notes, and snippets.

@briandk
Created November 14, 2011 04:20
Show Gist options
  • Save briandk/1363223 to your computer and use it in GitHub Desktop.
Save briandk/1363223 to your computer and use it in GitHub Desktop.
Experimenting with fscanf
#include <stdio.h>
int x;
int main (int argc, char const *argv[])
{
FILE *myFile = fopen("passenger.small.txt", "r");
char myString[1000];
int int1 = 0;
int int2 = 0;
int int3 = 0;
int i = 0;
int x = 1;
for (i = 1; i < 300; i++) {
if (fscanf(myFile, "%d%d%d\n", &int1, &int2, &int3) == EOF) {
printf("\nIteration: %d, EOF Returned", i);
};
}
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment