CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    May 1999
    Location
    Italy
    Posts
    39

    How DOS will call the "MyDirWithALongName" directory?

    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.

    _______

  2. #2
    Join Date
    Apr 1999
    Location
    Portland, OR, USA
    Posts
    18

    Re: How DOS will call the "MyDirWithALongName" directory?

    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
    [email protected]

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured