123456789101112131415161718192021222324252627282930313233 |
- #include <stdio.h>
- #include <stdlib.h>
- #include "tokenizer/File.h"
- static FILE* file = NULL;
- bool fOpen(const char* path) {
- file = fopen(path, "r");
- return file == NULL;
- }
- void fClose() {
- fclose(file);
- }
- int fRead() {
- return fgetc(file);
- }
- int fPeek() {
- int c = fRead();
- ungetc(c, file);
- return c;
- }
- bool fReadIf(int c) {
- if(fPeek() == c) {
- fRead();
- return true;
- }
- return false;
- }
|