3dphotoshoot
view src/assman.c @ 27:3d082c566b53
fixed all the bugs, pc version works
author | John Tsiombikas <nuclear@member.fsf.org> |
---|---|
date | Thu, 18 Jun 2015 04:32:25 +0300 |
parents | d7fe157c402d |
children |
line source
1 #include <stdio.h>
2 #include "assman.h"
4 int ass_fgetc(ass_file *fp)
5 {
6 unsigned char c;
8 if(ass_fread(&c, 1, 1, fp) < 1) {
9 return -1;
10 }
11 return (int)c;
12 }
14 char *ass_fgets(char *s, int size, ass_file *fp)
15 {
16 int i, c;
17 char *ptr = s;
19 if(!size) return 0;
21 for(i=0; i<size - 1; i++) {
22 if((c = ass_fgetc(fp)) == -1) {
23 break;
24 }
25 *ptr++ = c;
27 if(c == '\n') break;
28 }
29 *ptr = 0;
30 return ptr == s ? 0 : s;
31 }