MCPcopy Create free account
hub / github.com/bulletphysics/bullet3 / ImFileOpen

Function ImFileOpen

examples/ThirdPartyLibs/imgui/imgui.cpp:1495–1509  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1493}
1494
1495FILE* ImFileOpen(const char* filename, const char* mode)
1496{
1497#if defined(_WIN32) && !defined(__CYGWIN__)
1498 // We need a fopen() wrapper because MSVC/Windows fopen doesn't handle UTF-8 filenames. Converting both strings from UTF-8 to wchar format (using a single allocation, because we can)
1499 const int filename_wsize = ImTextCountCharsFromUtf8(filename, NULL) + 1;
1500 const int mode_wsize = ImTextCountCharsFromUtf8(mode, NULL) + 1;
1501 ImVector<ImWchar> buf;
1502 buf.resize(filename_wsize + mode_wsize);
1503 ImTextStrFromUtf8(&buf[0], filename_wsize, filename, NULL);
1504 ImTextStrFromUtf8(&buf[filename_wsize], mode_wsize, mode, NULL);
1505 return _wfopen((wchar_t*)&buf[0], (wchar_t*)&buf[filename_wsize]);
1506#else
1507 return fopen(filename, mode);
1508#endif
1509}
1510
1511// Load file content into memory
1512// Memory allocated with ImGui::MemAlloc(), must be freed by user using ImGui::MemFree()

Callers 3

ImFileLoadToMemoryFunction · 0.85
SaveIniSettingsToDiskFunction · 0.85
LogToFileMethod · 0.85

Calls 3

ImTextCountCharsFromUtf8Function · 0.85
ImTextStrFromUtf8Function · 0.85
resizeMethod · 0.45

Tested by

no test coverage detected