|
-
Jun 19th, 2002, 07:41 AM
#1
Thread Starter
Frenzied Member
edit text file
OK, so I don't have my MSDN disks and I can't find it on the net, and the search on here doesn't seem to want to work.
And this should be simple
How do I open a file, replace all double quotes (ie. ") with nothing (ie. ""), and then save that file?
I feel retarded even asking this because it seems like something that should be simple.
-
Jun 19th, 2002, 07:51 AM
#2
Hyperactive Member
Did not test this, but I'm pretty sure it works
VB Code:
Dim Path as string, f as integer, temp as string
Path = "C:\Target.txt"
f = freefile
Open path For Binary As #f
temp = Space(LOF(f)) 'Create a buffer for the file
Get #f,,temp 'Load the textfile into the buffer
temp = Replace(temp," ","") 'replace the space by nothing
Close #f 'close the file and kill it.
Kill path 'This because the previous data is longer then this data
Open path For Binary as #f
Put #f,,temp 'Write the data into the file and close it once again
Close #f
Last edited by Xa0z; Jun 19th, 2002 at 07:55 AM.
-
Jun 19th, 2002, 08:20 AM
#3
Thread Starter
Frenzied Member
that didn't seem to work... i think the problem is that that code replaces spaces... and i need to replace quotes around words. is there an escape character?
it doesn't like it when i do this:
VB Code:
temp = Replace(temp, """, "") 'replace the space by nothing
It wants to put another quotation mark somewhere
-
Jun 19th, 2002, 08:23 AM
#4
Hyperactive Member
-
Jun 19th, 2002, 08:24 AM
#5
Hyperactive Member
Ow sorry, I didn't read your post right :P. Thought you wanted to replace space chars. In that case use:
temp = Replace (temp, chr(34),"")
-
Jun 19th, 2002, 08:34 AM
#6
Thread Starter
Frenzied Member
ahh... perfect
-
Apr 8th, 2009, 07:42 AM
#7
New Member
Re: edit text file
I have a similar problem. I have a vb script that automatically sends an email to a predetermined email address over remote smtp. I have one that uses authorazation and one that doesn't. I would like a way to have user input be populated into several fields in this script. Just something as simple as "What is your email address?" and it enters the user input into the proper line of the script. There are about 6-7 strings I want to modify this way. I'm sure if I can get one done, I can modify it for each line. Any help is greatly appreciated.
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
|