GetShortPathName not working on x64 system
-
Hi All I am using the library function GetShortPathName to get the (windows)path name without spaces. Unfortunately this function is not working when I am compiling my output for x64 system The function is returning some garbage values. If it is a library function, I guess it uses C Run-Time Libraries (CRT), then why would it be different from 32 bit libraries. please note that my hard drive has NTFS and I can also see the short path name when I use the command dir /x . please help
-
Hi All I am using the library function GetShortPathName to get the (windows)path name without spaces. Unfortunately this function is not working when I am compiling my output for x64 system The function is returning some garbage values. If it is a library function, I guess it uses C Run-Time Libraries (CRT), then why would it be different from 32 bit libraries. please note that my hard drive has NTFS and I can also see the short path name when I use the command dir /x . please help
Ranojay wrote:
If it is a library function, I guess it uses C Run-Time Libraries (CRT), then why would it be different from 32 bit libraries.
Well, it doesn't use the CRT, actually - it's part of the OS and the CRT is layered on top of it. Have you thought of checking the return code? MSDN states this:
If the function succeeds, the return value is the length, in TCHARs, of the string that is copied to lpszShortPath, not including the terminating null character. If the lpszShortPath buffer is too small to contain the path, the return value is the size of the buffer, in TCHARs, that is required to hold the path. Therefore, if the return value is greater than cchBuffer, call the function again with a buffer that is large enough to hold the path. If the function fails for any other reason, the return value is zero (0). To get extended error information, call GetLastError.
Check the return value and (if it's zero), GetLastError, then repost.
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p