libc: Implement fileno()
This commit is contained in:
parent
d0d6557e99
commit
c77e752a82
@ -40,6 +40,9 @@ extern "C"
|
||||
/* Returns a new file associated with the file descriptor fd. */
|
||||
FILE* fdopen(int fd, const char* mode);
|
||||
|
||||
/* Returns the file descriptor associated with the file stream. */
|
||||
int fileno(FILE* stream);
|
||||
|
||||
/* Writes formatted output according to the string format to the file stream. */
|
||||
int fprintf(FILE* stream, const char* format, ...);
|
||||
|
||||
|
@ -53,6 +53,11 @@ extern "C"
|
||||
return stream;
|
||||
}
|
||||
|
||||
int fileno(FILE* stream)
|
||||
{
|
||||
return stream->f_fd;
|
||||
}
|
||||
|
||||
size_t fread(void* buf, size_t size, size_t nmemb, FILE* stream)
|
||||
{
|
||||
ssize_t status = read(stream->f_fd, buf, size * nmemb);
|
||||
|
Loading…
Reference in New Issue
Block a user