PDA

Click to See Complete Forum and Search --> : Dos Directory Format


Jan 7th, 2000, 10:47 AM
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?

Clunietp
Jan 7th, 2000, 02:24 PM
There is probably an API to do it, but here is some code I whipped up (VB6 only for JOIN/SPLIT functions):

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