MCPcopy Create free account
hub / github.com/PiSCSI/piscsi / CreateTempFileWithData

Function CreateTempFileWithData

cpp/test/test_shared.cpp:89–98  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

87}
88
89path CreateTempFileWithData(const span<const byte> data)
90{
91 const auto [fd, filename] = OpenTempFile();
92
93 const size_t count = write(fd, data.data(), data.size());
94 EXPECT_EQ(count, data.size()) << "Couldn't create temporary file '" << string(filename) << "'";
95 close(fd);
96
97 return path(filename);
98}
99
100// TODO Replace old-fashinoned C I/O by C++ streams I/O.
101// This also avoids potential issues with data type sizes and there is no need for c_str().

Callers 3

CreateTempFileFunction · 0.85
TESTFunction · 0.85
TESTFunction · 0.85

Calls 1

OpenTempFileFunction · 0.85

Tested by

no test coverage detected