FatCrab
Military
- Aug 4, 2003
- 1
Need help finding or building a routine to convert an UNIX type text file to a PC type text file. I think all I need to do is add a carriage return to the linefeed within the UNIX file.
Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
Private Sub ConvertFile( _
ByVal strInFileName As String, _
ByVal strOutFileName As String _
)
Dim strInFileContent As String
Dim strOutFileContent As String
Dim i As Long, j As Long
Open strInFileName For Input As #1
Open strOutFileName For Output As #2
Do Until EOF(1)
Line Input #1, strInFileContent
strOutFileContent = ""
j = 1
For i = 1 To Len(strInFileContent)
If Asc(Mid(strInFileContent, i, 1)) = 10 Then
strOutFileContent = strOutFileContent & vbCrLf
j = j + 2
Else
strOutFileContent = strOutFileContent & Mid(strInFileContent, i, 1)
j = j + 1
End If
Next
Print #2, strOutFileContent
Loop
Close #2
Close #1
End Sub