mirror of
https://gitlab.com/sortix/sortix.git
synced 2023-02-13 20:55:38 -05:00
Added fputc(3) and fgetc(3).
This commit is contained in:
parent
76800553da
commit
d39d4222b5
2 changed files with 15 additions and 2 deletions
|
@ -193,3 +193,16 @@ int fcloseall(void)
|
|||
return (result) ? EOF : 0;
|
||||
}
|
||||
|
||||
int fgetc(FILE* fp)
|
||||
{
|
||||
char c;
|
||||
if ( fread(&c, 1, sizeof(char), fp) < sizeof(char) ) { return EOF; }
|
||||
return c;
|
||||
}
|
||||
|
||||
int fputc(int c, FILE* fp)
|
||||
{
|
||||
if ( fwrite(&c, 1, sizeof(char), fp) < sizeof(char) ) { return EOF; }
|
||||
return c;
|
||||
}
|
||||
|
||||
|
|
|
@ -81,7 +81,9 @@ extern int feof(FILE* stream);
|
|||
extern int ferror(FILE* stream);
|
||||
extern int fflush(FILE* stream);
|
||||
extern int fileno(FILE* stream);
|
||||
extern int fgetc(FILE* stream);
|
||||
extern int fprintf(FILE* restrict stream, const char* restrict format, ...);
|
||||
extern int fputc(int c, FILE* stream);
|
||||
extern size_t fread(void* restrict ptr, size_t size, size_t nitems, FILE* restrict stream);
|
||||
extern int fseek(FILE* stream, long offset, int whence);
|
||||
extern long ftell(FILE* stream);
|
||||
|
@ -104,9 +106,7 @@ extern FILE* open_memstream(char** bufp, size_t* sizep);
|
|||
extern FILE* popen(const char* command, const char* mode);
|
||||
extern FILE* tmpfile(void);
|
||||
extern int dprintf(int fildes, const char* restrict format, ...);
|
||||
extern int fgetc(FILE* stream);
|
||||
extern int fgetpos(FILE* restrict stream, fpos_t* restrict pos);
|
||||
extern int fputc(int c, FILE* stream);
|
||||
extern int fputs(const char* restrict s, FILE* restrict stream);
|
||||
extern int fscanf(FILE* restrict stream, const char* restrict format, ... );
|
||||
extern int fseeko(FILE* stream, off_t offset, int whence);
|
||||
|
|
Loading…
Add table
Reference in a new issue