From 45385407700a3011eccbfddbdf2a2733aa57dfbe Mon Sep 17 00:00:00 2001 From: mattn Date: Mon, 19 May 2014 09:03:18 +0900 Subject: Add win32 FormatError example --- template/c/snip-win32-formaterror.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 template/c/snip-win32-formaterror.c (limited to 'template/c') diff --git a/template/c/snip-win32-formaterror.c b/template/c/snip-win32-formaterror.c new file mode 100644 index 0000000..bfb88f7 --- /dev/null +++ b/template/c/snip-win32-formaterror.c @@ -0,0 +1,13 @@ +void* pbuf; +FormatMessageA( + FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM, + NULL, + GetLastError(), + MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), // Default language + (LPSTR) &pbuf, + 0, + NULL +); + +{{_cursor_}} +LocalFree(pbuf); -- cgit v1.2.3-54-g00ecf