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

Function ReadTextFile

tools/io.cpp:397–413  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

395}
396
397bool ReadTextFile(const char* filename, std::vector<char>* data) {
398 assert(data->empty());
399
400 const bool use_file = filename && strcmp("-", filename);
401 FILE* fp = nullptr;
402 if (use_file) {
403 fp = fopen(filename, "r");
404 } else {
405 SET_STDIN_TO_TEXT_MODE();
406 fp = stdin;
407 }
408
409 ReadFile(fp, data);
410 bool succeeded = WasFileCorrectlyRead(fp, filename);
411 if (use_file && fp) fclose(fp);
412 return succeeded;
413}
414
415namespace {
416// A class to create and manage a file for outputting data.

Callers 3

mainFunction · 0.85
load_moduleFunction · 0.85
mainFunction · 0.85

Calls 3

ReadFileFunction · 0.85
WasFileCorrectlyReadFunction · 0.85
emptyMethod · 0.45

Tested by

no test coverage detected