Created
January 31, 2010 16:40
-
-
Save hlian/291137 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <stdlib.h> | |
enum { MAX_READ_BYTES = 1024 }; | |
int main(void) { | |
FILE *f = fopen("data.txt"); | |
char buffer[MAX_READ_BYTES]; | |
char *ret; | |
/* Get rid of file header. */ | |
ret = fgets(buffer, MAX_READ_BYTES, f); | |
assert(ret == buffer); | |
while (fgets(buffer, MAX_READ_BYTES, f) != NULL) { | |
int num = /* something */; | |
particle *event_data = particle_init(num); | |
read_event_data(event_data, buffer); | |
particle_free(event_data); | |
} | |
fclose(f); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment