MCPcopy Create free account
hub / github.com/ValveSoftware/openvr / Path_WriteBinaryFile

Function Path_WriteBinaryFile

samples/shared/pathtools.cpp:636–657  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

634}
635
636bool Path_WriteBinaryFile(const std::string &strFilename, unsigned char *pData, unsigned nSize)
637{
638 FILE *f;
639#if defined( POSIX )
640 f = fopen(strFilename.c_str(), "wb");
641#else
642 std::wstring wstrFilename = UTF8to16( strFilename.c_str() );
643 errno_t err = _wfopen_s( &f, wstrFilename.c_str(), L"wb" );
644 if (err != 0)
645 {
646 f = NULL;
647 }
648#endif
649
650 size_t written = 0;
651 if (f != NULL) {
652 written = fwrite(pData, sizeof(unsigned char), nSize, f);
653 fclose(f);
654 }
655
656 return written = nSize ? true : false;
657}
658
659std::string Path_ReadTextFile( const std::string &strFilename )
660{

Callers

nothing calls this directly

Calls 1

UTF8to16Function · 0.70

Tested by

no test coverage detected