MCPcopy Create free account
hub / github.com/KhronosGroup/SPIRV-Tools / ReadFile

Function ReadFile

tools/io.cpp:42–50  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

40// file is of type |T|.
41template <typename T>
42void ReadFile(FILE* file, std::vector<T>* data) {
43 if (file == nullptr) return;
44
45 const int buf_size = 4096 / sizeof(T);
46 T buf[buf_size];
47 while (size_t len = fread(buf, sizeof(T), buf_size, file)) {
48 data->insert(data->end(), buf, buf + len);
49 }
50}
51
52// Returns true if |file| has encountered an error opening the file or reading
53// from it. If there was an error, writes an error message to standard error.

Callers 2

ReadBinaryFileFunction · 0.85
ReadTextFileFunction · 0.85

Calls 2

insertMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected