How to read a file and write into a text file?

前端 未结 4 1871
悲哀的现实
悲哀的现实 2020-12-17 21:01

I want to open mis file, copy all the data and write into a text file.

My mis file.

File name – 1.mis

M3;3395;44;0;1;;20090404;094144;8193;3;         


        
4条回答
  •  清歌不尽
    2020-12-17 21:22

    If you want to do it line by line:

    Dim sFileText As String
    Dim iInputFile As Integer, iOutputFile as integer
    
    iInputFile = FreeFile
    Open "C:\Clients\Converter\Clockings.mis" For Input As #iInputFile 
    iOutputFile = FreeFile
    Open "C:\Clients\Converter\2.txt" For Output As #iOutputFile 
    Do While Not EOF(iInputFile)
       Line Input #iInputFile , sFileText
       ' sFileTextis a single line of the original file
       ' you can append anything to it before writing to the other file
       Print #iOutputFile, sFileText 
    Loop
    Close #iInputFile 
    Close #iOutputFile 
    

提交回复
热议问题