MCPcopy Create free account
hub / github.com/WasmEdge/WasmEdge / openFileForRead

Function openFileForRead

test/host/wasi/wasi.cpp:4277–4289  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4275}
4276
4277int openFileForRead(const fs::path &Filename) {
4278 int Fd = -1;
4279 const std::string PathStr = Filename.u8string();
4280#if WASMEDGE_OS_WINDOWS
4281 if (_sopen_s(&Fd, PathStr.c_str(), _O_RDONLY | _O_BINARY, _SH_DENYNO, 0) !=
4282 0) {
4283 return -1;
4284 }
4285#else
4286 Fd = open(PathStr.c_str(), O_RDONLY);
4287#endif
4288 return Fd;
4289}
4290
4291void closeFd(int Fd) {
4292 if (Fd == -1)

Callers 1

TESTFunction · 0.85

Calls 1

c_strMethod · 0.80

Tested by

no test coverage detected