0
嗨我想創建一個函數在VB6.0從cfd文件中讀取行,然後從該文件中刪除空行?任何人都可以幫助我嗎?閱讀cfd /文件和刪除空行
我想說的是。
/The file is already read through a ReadStream
/Once its read I would like to identify the blank rows
/delete them.take the blank rows
我想在這裏一堆不同的方法是最後一個:
Do Until Len(msLineRecord) = ReadStream.AtEndOfStream
msLineRecord = Replace(msLineRecord, vbNewLine & vbNewLine, vbNewLine)
msLineRecord = Len(msLineRecord)
Loop
而且
Do Until ReadStream.AtEndOfStream
If LenB(Trim$(strLine)) = 0 Then
If Not bFoundBlankLine Then
Print #2, strLine bFoundBlankLine = True
End If
Else
Print #2, strLine
End If
Loop
Close ff1
Close ff2
Kill "C:\temp\blank lines.txt"
Name "C:\temp\MyTemp.tmp" As "C:\temp\blank lines.txt"
打開一個臨時文件,並且當您從源文件讀取行時,如果它們不是空白,請將它們寫入臨時文件。完成後刪除原始文件並將臨時文件重命名爲原始文件名。 – jac
謝謝,你還可以告訴我代碼。 – user3347312
不,你還沒有提供任何代碼供我使用。 – jac