|
CX Framework
Cross-platform C utility framework
|
#include <fileobj.h>
An open file
Every open file is a File, whichever layer opened it: fsOpen() hands back one backed by an OS file handle, and vfsOpen() one backed by a VFS provider. Code that only reads and writes can take a File* and work with either.
A File is reference counted. fileClose() closes the file and releases your reference; objRelease() only releases the reference, and closes the file if it was the last one.
A file handle is single-owner: one thread at a time, like a C FILE*. Two threads may use two handles on the same file, but they must not share one handle.