I wanted a means of checking is a file exists on the disk based on wchar_t * path. A ready to use method is available on SO but for char * path. Is there a variant for wchar_t * without using boost.
Loot at this example:
#include <fstream>
#include <string>
bool check_if_file_exists(std::wstring path)
{
std::ifstream ff(path.c_str());
return ff.is_open();
}
But this is windows only, since std::ifstream(wchar_t*) is MSVC extension.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.