• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 #include <stdio.h>
2 
3 // ugly hack because we don't have fscanf
4 
fscanf(FILE * stream,const char * format,int * value)5 int fscanf(FILE* stream, const char* format, int* value)
6 {
7     int c;
8     int r = 0;
9     do {
10         c = fgetc(stream);
11         if (c>='0' && c<='9') {
12             r = r*10 + (c-'0');
13             continue;
14         }
15         break;
16     } while (1);
17 
18     *value = r;
19 
20     // gahhhh
21     return 1;
22 }
23