Skip to content

Instantly share code, notes, and snippets.

@crewjam
Last active August 29, 2015 14:16
Show Gist options
  • Save crewjam/1d69eee9623d71738153 to your computer and use it in GitHub Desktop.
Save crewjam/1d69eee9623d71738153 to your computer and use it in GitHub Desktop.
wide character path test program
// cl test.cc & test.exe
#include <windows.h>
#include <stdio.h>
int main() {
wchar_t path[] = L"a<b";
CreateFileW(path, GENERIC_WRITE, 0, NULL, CREATE_NEW, FILE_ATTRIBUTE_NORMAL, NULL);
LPVOID lastErrorString;
DWORD lastError = GetLastError();
FormatMessageA(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, NULL, lastError, 0, (LPTSTR) &lastErrorString, 0, NULL);
printf("error: %d %s\n", lastError, lastErrorString);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment