How to create txt file

后端 未结 2 1701
北荒
北荒 2021-01-01 02:27

I have to create a txt file so with some large content in VB6. Can anybody help me out on this and please tell me the references also.

2条回答
  •  Happy的楠姐
    2021-01-01 03:06

    This is how you can create a text file in VB6

    Dim iFileNo as Integer
    iFileNo = FreeFile
    'open the file for writing
    Open "C:\Test.txt" For Output As #iFileNo
    'please note, if this file already exists it will be overwritten!
    
    'write some example text to the file
    Print #iFileNo, "first line of text"
    Print #iFileNo, " second line of text"
    Print #iFileNo, "" 'blank line
    Print #iFileNo, "some more text!"
    
    'close the file (if you dont do this, you wont be able to open it again!)
    Close #iFileNo
    

    Source

提交回复
热议问题