blob: 246cc51ef847a6139939c7c55161dc1f24ecaa69 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
|
#include <stdio.h>
#include <errno.h>
// https://pubs.opengroup.org/onlinepubs/9699919799/functions/fileno.html
// The fileno() function shall return the integer file descriptor associated
// with the stream pointed to by stream.
int fileno(FILE *stream) {
if (-1 == stream->fd) {
errno = EBADF;
return -1;
}
return stream->fd;
}
|