|
-
February 24th, 2000, 04:36 AM
#1
How to update data in file?
How to update data in File? (AS Text File)
Ex. Like Find and Replace when I would like to change some words.(Eet -->change to --> Eat)
-
February 24th, 2000, 05:19 AM
#2
Re: How to update data in file?
I'd read the complete file into memory (if it's not too big), close the file
make the modifications using VB's Replace function,
Open it for writing and rewrite the modified contents.
Actually, I'd rather use a Win32 port of the UNIX stream editor (SED), available from the GNU Site.
Thus, I wouldn't have to write a program.
-
February 24th, 2000, 06:00 AM
#3
Re: How to update data in file?
You could try this sort of thing
Dim str as string
Dim filename as string
filename = "C:/myfile.txt"
Open filename for binary as #1
str = Space(LOF(1))
get #1, , str
str = Replace(str, "replacethis", "withthis")
Close #1
Kill filename
Open filename for Output as #1
print #1, Trim(str)
Close #1
Not the best code in the world but it will work.
-
February 24th, 2000, 09:20 PM
#4
Re: How to update data in file?
I 'm not understand about "Kill filename" because when I comment it.The procedue is work.And What is this statement "str = Space(LOF(1))"? It's about the number of line in file right?
Please reply me, Thanks a lot for your procedue.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|