From: Tor L. <tm...@ik...> - 2010-09-20 16:52:27
|
> Is there a simple way, in MSYS bash, to convert a file name to its short DOS form? #include <windows.h> #include <stdio.h> int main (int argc, char **argv) { char shortpath[MAX_PATH]; int rc; if (argc != 2) fprintf (stderr, "Usage: %s pathname\n", argv[0]), exit (1); rc = GetShortPathNameA (argv[1], shortpath, sizeof (shortpath)); if (rc > sizeof (shortpath) || rc == 0) fprintf (stderr, "GetShortPathName failed\n"), exit (1); printf ("%s\n", shortpath); return 0; } (Should obviously be built as a native Win32 program, not a MSYS program.) --tml |