Skip to content

Instantly share code, notes, and snippets.

@mattn
Last active August 29, 2015 14:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mattn/d95eaa2d01fc96399db8 to your computer and use it in GitHub Desktop.
Save mattn/d95eaa2d01fc96399db8 to your computer and use it in GitHub Desktop.
#include <stdio.h>
#include <shlwapi.h>
int
main(int argc, char* argv[]) {
char buf[256];
strcpy(buf, "XXXXXXXXXXXXXXX");
_snprintf(buf, 8, "1234%s", "abcdef");
puts(buf);
return 0;
}
// mingw 1234abcdXXXXXXX, msvc 1234abcdXXXXXXX
#include <stdio.h>
#include <shlwapi.h>
int
main(int argc, char* argv[]) {
char buf[256];
strcpy(buf, "XXXXXXXXXXXXXXX");
wnsprintf(buf, 8, "1234%s", "abcdef");
puts(buf);
return 0;
}
// mingw 1234abc, msvc 1234abc
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment