impl char/string IO functions

This commit is contained in:
Yuichi Nishiwaki 2014-01-16 18:35:22 +09:00
parent f043fbb0a7
commit 4d0a448a44
1 changed files with 32 additions and 0 deletions

View File

@ -108,6 +108,38 @@ pic_fclose(pic_file *file)
return 0;
}
int
pic_fgetc(pic_file *file)
{
char buf[1];
pic_fread(buf, 1, 1, file);
return buf[0];
}
int
pic_fputc(int c, pic_file *file)
{
char buf[1];
buf[0] = c;
pic_fwrite(buf, 1, 1, file);
return buf[0];
}
int
pic_fputs(const char *str, pic_file *file)
{
int len;
len = strlen(str);
pic_fwrite(str, len, 1, file);
return 0;
}
static void write_pair(pic_state *pic, struct pic_pair *pair);
static void write_str(pic_state *pic, struct pic_string *str);