March 14th, 2003, 12:39 PM
Writing to files
Currently I am writing a program which reads a text file and sets it out in the form of an INI file. So that my PHP can read it (but thats another story). I use this kind of code to write to a file at the moment:
Dim lngFile as long
Open *filename* For Append As #lngFile
Write #lngFile, "Information here"
The output in the file is this:
My problem is that I don't want the speech marks in there. Is there anyway I can get rid of these speech marks?
[edited due to mistake]
March 14th, 2003, 01:33 PM
AFIAK the # sign is required in these statements.
March 14th, 2003, 02:23 PM
I don't mind the # sign in the code.
Its the speech marks I worry about.
Or are the two related?
March 14th, 2003, 02:36 PM
speech marks? Please explain what you mean. Are you refering to quotes? If so then they are required if you are putting a constant in, but not a variable.
dim fp as Long
dim filename as String
dim tmpVar as String
filename = "C:\test.ini"
tmpVar = "Some variable text"
fp = FreeFile
Open filename for Append as #fp
Print #fp, "Some constant text"
Print #fp, tmpVar
March 14th, 2003, 04:26 PM
It was the Write that was the problem.
I just needed Print.
Last edited by K-TC; March 14th, 2003 at 04:38 PM.
March 14th, 2003, 05:26 PM
do you know there is an api to write in ini format? If you're interested I can provide some code.
March 14th, 2003, 05:48 PM
Thank you hedge, but I know about those Apis.
I just wanted an alternate way of doing it.
Its useful to know .
Thank you anyway.
(You people are great!)
March 31st, 2003, 10:40 PM
put your information in a variable
info$ = "information"
Write #lngFile, info$