| Computing.Net: Over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to sign up now, it's free! |
vb read and write file
|
Original Message
|
Name: gorf
Date: June 1, 2003 at 18:05:37 Pacific
Subject: vb read and write fileOS: winxpCPU/Ram: 2600+ / 512mb pc3200 |
Comment: anyone know how to read a file in vb like read file.txt text form file go to text1.text and write to file
Report Offensive Message For Removal
|
|
Response Number 2
|
Name: micah
Date: June 2, 2003 at 20:36:07 Pacific
|
Reply: (edit)Dim FileData As String Open "c:\file.txt" For Binary Access Read As #1 FileData = Space(LOF(1)) Get 1, , FileData Close #1 That'll read. Open "c:\text1.txt" For Binary Access Write As #1 Put 1, , FileData Close #1 That'll write... You can also read and write to the same file at the same time. Dim FileData As String Open "c:\blabla.txt" For Binary Access Read Write As #1 FileData = Space(LOF(1)) Get 1, , FileData Put 1, , "stuff" & FileData Close #1 Easy enough?
Report Offensive Follow Up For Removal
|
|
Response Number 5
|
Name: Chi Happens
Date: June 22, 2003 at 05:46:13 Pacific
|
Reply: (edit)Well, not certain about the sex of the object but: App.Path works for the current path. you might need to append a "\" before your file name tho. like FileSpec = App.Path & "\myfile.txt"
Report Offensive Follow Up For Removal
|
|
Response Number 6
|
Name: Carlos Eugênio
Date: July 17, 2003 at 10:31:15 Pacific
|
Reply: (edit)I'm doing like you said, but when I execute the following error appears: Runtime Error: 75 Path/File access error Please, answer me on my email. Thanks!
Report Offensive Follow Up For Removal
|
|
Response Number 7
|
Name: Carlos Eugênio
Date: July 17, 2003 at 10:41:56 Pacific
|
Reply: (edit)In fact, I’d like to read the contents of a binary file, find an specific string in it and finally change this string with another one I want, writing it on the same file, keeping the binary aspect and not damaging the file. As we do using hexdecimal editors. How can I do it? Please, answer me on my email. Thanks.
Report Offensive Follow Up For Removal
|

Post Locked
This post is quite old and has been locked from receiving new replies. Please create a new posting instead.
Go to Programming Forum Home