Skip to main content
GameDev.net gamedev.net
🔒 Locked

[VC++] Delete file with Unicode file-name?

Started by DarkRadeon Jan 5, 2012 at 8:14 PM 6 replies 8.2k views
Original Post
DarkRadeon
DarkRadeon
I must delete a file with an Unicode name. The file-name is stored in a wstring. Is there a way to do it without using windows api?

std::remove( ) of cstdio library doesn't work with wchar_t...
the_edd
the_edd
I do not believe so. There are of course a libraries that wrap Windows file handling functions, to present a platform neutral interface. Other than that, I fear you may be out of luck.
DarkRadeon
DarkRadeon
Tnx

I will continue to use DeleteFileW of Windows.h..
bubu LV
bubu LV
There is int _wremove(const wchar_t* path) function in
DarkRadeon
DarkRadeon

There is int _wremove(const wchar_t* path) function in
tnx
the_edd
the_edd

There is int _wremove(const wchar_t* path) function in

I think _wremove() is a Windows-specific function (not sure whether one would class it as part of the Windows API, or whether that matters to the OP)
DarkRadeon
DarkRadeon
mmm OK, but this should avoid the need of VC++ redistributable for the end user.. I hope that with VC++12 MS will finally bring standard Unicode support (VC++11 will not support it .-. )
the_edd
the_edd
_wremove is in the CRT, implying that you'll need to ship a CRT redistrubable installer anyway unless you statically link againt the CRT.

DeleteFile(W|A) is actually in kernel32.dll, which requires no redistributable installer.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.