comparison gecko/src/commonFunctions.c @ 1:35af401890c0 draft

Uploaded
author bitlab
date Thu, 13 Dec 2018 07:59:25 -0500
parents
children
comparison
equal deleted inserted replaced
0:ee6b15b409e5 1:35af401890c0
1 #include <stdio.h>
2 #include <stdlib.h>
3 #include <inttypes.h>
4 #include <string.h>
5 #include "structs.h"
6
7 void terror(char *s) {
8 printf("ERR**** %s ****\n", s);
9 exit(-1);
10 }
11
12 char buffered_fgetc(char *buffer, uint64_t *pos, uint64_t *read, FILE *f) {
13 if (*pos >= READBUF) {
14 *pos = 0;
15 memset(buffer, 0, READBUF);
16 *read = fread(buffer, 1, READBUF, f);
17 }
18 *pos = *pos + 1;
19 return buffer[*pos-1];
20 }