Acquire ownership of a file, without blocking
#include <stdio.h> int ftrylockfile( FILE* file );
Use the -l c option to qcc to link against this library. This library is usually included automatically.
The ftrylockfile() function is used by a thread to acquire ownership of a FILE if the object is available; ftrylockfile() is a nonblocking version of flockfile(). To unlock the file, call funlockfile().
POSIX 1003.1 TSF
flockfile(), funlockfile(), getc_unlocked(), getchar_unlocked(), putc_unlocked(), putchar_unlocked()