Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations sizbut on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Printing to files using special characters (like quotation marks)

Status
Not open for further replies.

napjunk

Technical User
Dec 20, 2001
11
US
Ok, i just want to say i've been lurking around these boards for a few months now and have learned alot and would like to thank yall for that. I have a questions about writing data to files. I'm writing a program that creates a file that you can enter into your registry.

The problem is if i use the

write #1, "stuff in here"

it will come out in the file as

"stuff in here"

and if i use the

print #1, "stuff in here"

it will come out in the file as

stuff in here

now the print function will work fine for part of what i want to do, like for this:
[HKEY_LOCAL_MACHINE\SOFTWARE\APPNAME]

but,as you know (if you've ever looked at registry entries), there are parts that look like this:

"WinLeft"="-4"
"WinTop"="-4"
"WinCx"="808"
"WinCy"="580"
"MaxCx"="808"
"MaxCy"="580"
"Share Save Folder"=dword:00000001
"DefFlag"="0"

how would i print it like that? to where i would have QUOTES around one part of the text, then no quotes around the equal sign, and then quotes around the -4 part?

Thanks for any help yall might be able to give.
 
If you are going to write to a file then the string would look something like

Dim sPos as String
sPos = """" & "WinLeft" & """" & "=" & """" & "-4" """"

If you want double quotes use 4 double quotes or use chr(34) instead.

However if you are going to write to the registry then I suggest you use CreateRegEntry which returns a boolean that way you will know if it succeeds. The help files should be able to help you out. If you are only concerned with the apps registry then SaveSettings is an easier function to deal with.

HTH,
jc
 
Ok thank you very much,What i am doing isn't writing directly to the registry. It's creating a .reg file that users can then import into the registry. Thanks for your help.

=0)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top