Results 1 to 2 of 2

Thread: Dos Directory Format

  1. #1
    Guest

    Post

    What is the name of the API to conert a path to dos format (C:\PROGRA~1\MICROS~1\ect.). Or if its not a API is there a easy way to do it?

  2. #2
    Guru Clunietp's Avatar
    Join Date
    Oct 1999
    Location
    USA
    Posts
    1,844

    Post

    There is probably an API to do it, but here is some code I whipped up (VB6 only for JOIN/SPLIT functions):
    Code:
        Dim str As String
        Dim strNew As String
        Dim tmpArray() As String
        Dim i As Integer
        
        str = "C:\Program Files\Common Files\System"
        
        tmpArray = Split(str, "\")
        
        For i = LBound(tmpArray) To UBound(tmpArray)
            If Len(tmpArray(i)) > 8 Then
                tmpArray(i) = Left(tmpArray(i), 6) & "~1"
            End If
        Next i
        
        strNew = Join(tmpArray, "\")
        
        MsgBox strNew
    This would not be reliable if there were two similar directory names, in DOS one would be ~1, the next would be ~2, etc. but the chance of that is usually pretty slim....

    Tom

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