VBcoders Guest



Don't have an account yet? Register
 


Forgot Password?



Read and write a simple text file

by Sharky (1 Submission)
Category: Windows System Services
Compatability: Visual Basic 5.0
Difficulty: Unknown Difficulty
Originally Published: Wed 29th December 1999
Date Added: Mon 8th February 2021
Rating: (1 Votes)

Read and write a simple text file

Rate Read and write a simple text file



Open "C:\1.txt" for Input As #1
'Open the file for reading and number it as #1
Input #1, line1$, line$, line3$
'Read the first three lines of the file
Close #1
'Close the file.

'*****Write file**********
Open "C:\1.txt for Output As #2
'Open the file to write
Print #2, "This is line 1"
'Write something in the first line
Print #2, "This is line 2"
'Write something in the second line
Print #2, "This is the last line"
'Write something in line 3

Close #2
'Close the file


Download this snippet    Add to My Saved Code

Read and write a simple text file Comments

No comments have been posted about Read and write a simple text file. Why not be the first to post a comment about Read and write a simple text file.

Post your comment

Subject:
Message:
0/1000 characters