3dphotoshoot
view src/assman.c @ 25:ac80210d5fbe
preparing a pc version for easier development of non-android-specifics
author | John Tsiombikas <nuclear@member.fsf.org> |
---|---|
date | Thu, 18 Jun 2015 03:12:30 +0300 |
parents | |
children | 3d082c566b53 |
line source
1 #include "assman.h"
3 int ass_fgetc(ass_file *fp)
4 {
5 char c;
7 if(ass_fread(&c, 1, 1, fp) < 1) {
8 return -1;
9 }
10 return c;
11 }
13 char *ass_fgets(char *s, int size, ass_file *fp)
14 {
15 int i, c;
16 char *ptr = s;
18 if(!size) return 0;
20 for(i=0; i<size - 1; i++) {
21 if((c = ass_fgetc(fp)) == -1) {
22 break;
23 }
24 *ptr++ = c;
26 if(c == '\n') break;
27 }
28 *ptr = 0;
29 return ptr == s ? 0 : s;
30 }