pub fn openat(dir_fd: fd_t, file_path: []const u8, flags: O, mode: mode_t) OpenError!fd_t 441
442
443
444
445
446
447
448
449pub fn openat(dir_fd: fd_t, file_path: []const u8, flags: O, mode: mode_t) OpenError!fd_t {
if (native_os == .windows) {
@compileError("Windows does not support POSIX; use Windows-specific API or cross-platform std.fs API");
} else if (native_os == .wasi and !builtin.link_libc) {
@compileError("use std.Io instead");
}
const file_path_c = try toPosixPath(file_path);
return openatZ(dir_fd, &file_path_c, flags, mode);
}
Open and possibly create a file. Keeps trying if it gets interrupted.
file_pathis relative to the open directory handledir_fd. On Windows,file_pathshould be encoded as WTF-8. On WASI,file_pathshould be encoded as valid UTF-8. On other platforms,file_pathis an opaque sequence of bytes with no particular encoding. See alsoopenatZ.