- ©«¤l
- 472
- ¥DÃD
- 5
- ºëµØ
- 0
- ¿n¤À
- 485
- ÂI¦W
- 0
- §@·~¨t²Î
- Windows
- ³nÅ骩¥»
- MS Office
- ¾\ŪÅv
- 100
- ©Ê§O
- ¨k
- ¨Ó¦Û
- »´ä
- µù¥U®É¶¡
- 2010-7-4
- ³Ì«áµn¿ý
- 2014-12-28
|
¦^´_ 1# play9091
¬d¬Ý¤@¤UFSO(FILE SYSTEM OBJECT)À³¥Î- Sub ReadStrangeFile()
- Dim FSO As Object 'FileSystemObject
- Dim FSOFile As Object 'File
- Dim FSOStream As Object 'TextStream
- Dim FSOStreamWrite As Object 'TextStream
- Dim strFileName As String
- Dim strFileNameNew As String
- Dim strCurrLine As String
-
- Set FSO = CreateObject("Scripting.FileSystemObject") 'FileSystemObject
-
- strFileName = "C:\blog\tw\txt\203-¾ã²z«e.txt"
- Set FSOFile = FSO.GetFile(strFileName)
- Set FSOStream = FSOFile.OpenAsTextStream(1, -2) 'ForReading, TristateUseDefault
-
- strFileNameNew = "C:\blog\tw\txt\203-¾ã²z«á.txt"
- Set FSOStreamWrite = FSO.OpenTextFile(strFileNameNew, 2, True) 'ForWriting
- strCurrLine = ""
- Do While Not FSOStream.AtEndOfStream
- strCurrLine = strCurrLine & FSOStream.ReadLine
- If Right(Trim(strCurrLine), 3) = "END" Then
- FSOStreamWrite.WriteLine (strCurrLine)
- strCurrLine = ""
- End If
- Loop
- FSOStream.Close
- FSOStreamWrite.Close
- End Sub
½Æ»s¥N½X |
|