Click to See Complete Forum and Search --> : How DOS will call the "MyDirWithALongName" directory?


a_fischetti
April 30th, 1999, 10:52 AM
Can I know how DOS will truncate and call a directory I created under Windows 9x or (NT) whose name is longer than 8 characters?
Thanks in advance.
Bye.

_______

ValerieB
April 30th, 1999, 11:13 AM
The way it's typically done is that the first 6 non-whitespace characters are used, then a tilde (~) character is added, then a number. So, if you have two directories named:

My Awesome Docs
My Awesome Images

They will be converted into:

myawes~1 (Short for My Awesome Docs)
myawes~2 (Short for My Awesome Images)

If you need to get this conversion programmatically, then there's a Win32 function called GetShortPathName() that takes a LFN path and converts it to a SFN.

NOTE: The path in question must actually exist on the PC for this function to work correctly. If it doesn't exist, GetShortPathName() will return an error.

Hope this helps! Good luck, and happy coding!

Valerie Bradley
http://www.synthcom.com/~val
val@synthcom.com