FileFromFd
Description
Borrow a file handle wrapping an already-open fd / HANDLE. The returned File has owns = false so FileClose is a no-op on it. Use for wrapping stdin / stdout / stderr or fds you got from elsewhere.
Usage example (Cross-references)
Usage examples (Cross-references)
- In
Log.c:56:
StrWriteFmt(&full, "[{}] [{}:{}] {}\n", (const char *)NAMES[type], (const char *)tag, line, (const char *)msg);
File out = (type == LOG_MESSAGE_TYPE_INFO) ? FileFromFd(1) : FileFromFd(2);
(void)FileWrite(&out, full.data, full.length);- In
File.c:144:
}
File FileFromFd(i32 fd) {
File f = {0};
#ifdef _WIN32- In
File.c:161:
return f;
#else
return FileFromFd(0);
#endif
}- In
File.c:170:
return f;
#else
return FileFromFd(1);
#endif
}- In
File.c:179:
return f;
#else
return FileFromFd(2);
#endif
}
Last updated on