Add filestream_putc

This commit is contained in:
twinaphex 2016-04-07 03:23:01 +02:00
parent f0a1b94a11
commit 2bb90f3702
2 changed files with 14 additions and 0 deletions

View File

@ -66,6 +66,8 @@ int filestream_read_file(const char *path, void **buf, ssize_t *len);
bool filestream_write_file(const char *path, const void *data, ssize_t size);
int filestream_putc(RFILE *stream, int c);
int filestream_get_fd(RFILE *stream);
#ifdef __cplusplus

View File

@ -409,6 +409,18 @@ error:
return -1;
}
int filestream_putc(RFILE *stream, int c)
{
if (!stream)
return EOF;
#if defined(HAVE_BUFFERED_IO)
return fputc(c, stream->fp);
#else
return EOF;
#endif
}
int filestream_close(RFILE *stream)
{
if (!stream)