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

Function Path_WriteStringToTextFile

samples/shared/pathtools.cpp:685–708  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

683
684
685bool Path_WriteStringToTextFile( const std::string &strFilename, const char *pchData )
686{
687 FILE *f;
688#if defined( POSIX )
689 f = fopen( strFilename.c_str(), "w" );
690#else
691 std::wstring wstrFilename = UTF8to16( strFilename.c_str() );
692 errno_t err = _wfopen_s( &f, wstrFilename.c_str(), L"w" );
693 if ( err != 0 )
694 {
695 f = NULL;
696 }
697#endif
698
699 bool ok = false;
700
701 if ( f != NULL )
702 {
703 ok = fputs( pchData, f) >= 0;
704 fclose(f);
705 }
706
707 return ok;
708}
709
710bool Path_WriteStringToTextFileAtomic( const std::string &strFilename, const char *pchData )
711{

Callers 1

Calls 1

UTF8to16Function · 0.70

Tested by

no test coverage detected