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

Function WriteFile

tools/io.cpp:455–471  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

453
454template <typename T>
455bool WriteFile(const char* filename, const char* mode, const T* data,
456 size_t count) {
457 OutputFile file(filename, mode);
458 FILE* fp = file.GetFileHandle();
459 if (fp == nullptr) {
460 fprintf(stderr, "error: could not open file '%s'\n", filename);
461 return false;
462 }
463
464 size_t written = fwrite(data, sizeof(T), count, fp);
465 if (count != written) {
466 fprintf(stderr, "error: could not write to file '%s'\n", filename);
467 return false;
468 }
469
470 return true;
471}
472
473template bool WriteFile<uint32_t>(const char* filename, const char* mode,
474 const uint32_t* data, size_t count);

Callers 7

DumpShaderFunction · 0.85
mainFunction · 0.85
mainFunction · 0.85
ShrinkFunction · 0.85
DumpShaderFunction · 0.85
DumpShaderFunction · 0.85
DumpShaderFunction · 0.85

Calls 1

GetFileHandleMethod · 0.80

Tested by 2

DumpShaderFunction · 0.68
DumpShaderFunction · 0.68