The proper function is int fileno(FILE *stream)
. It can be found in <stdio.h>
, and is a POSIX standard but not standard C.
More Related Contents:
- Are there any platforms where using structure copy on an fd_set (for select() or pselect()) causes problems?
- printf anomaly after “fork()”
- How to make child process die after parent exits?
- Retrieve filename from file descriptor in C
- What is the equivalent to Posix popen() in the Win32 API?
- How to capture Control+D signal?
- Why does this program print “forked!” 4 times?
- Why does stat fail using a name from readdir? [duplicate]
- stdout thread-safe in C on Linux?
- What does the brk() system call do?
- Why does ENOENT mean “No such file or directory”?
- POSIX API call to list all the pthreads running in a process
- Merge multiple .so shared libraries
- Re-opening stdout and stdin file descriptors after closing them
- Turn a simple socket into an SSL socket
- How do I get a thread ID from an arbitrary pthread_t?
- After forking, are global variables shared?
- Set environment variables in C
- Are file descriptors shared when fork()ing?
- Detecting 64bit compile in C
- practical examples use dup or dup2
- How to get the current time in milliseconds from C in Linux?
- fcntl, lockf, which is better to use for file locking?
- Recursive mkdir() system call on Unix
- Is there an equivalent to WinAPI’s MAX_PATH under linux/unix?
- Linux/POSIX equivalent for Win32’s CreateEvent, SetEvent, WaitForSingleObject
- Questions about putenv() and setenv()
- In C, what’s the size of stdout buffer?
- Checking if errno != EINTR: what does it mean?
- How to know if a Linux system call is restartable or not?