#1
  1. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Feb 2003
    Location
    England
    Posts
    12
    Rep Power
    0

    Question Writing to files


    Hello, DevShed.

    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"
    Close #lngFile

    The output in the file is this:
    "Information here"

    My problem is that I don't want the speech marks in there. Is there anyway I can get rid of these speech marks?

    Thank you.

    [edited due to mistake]
  2. #2
  3. /(bb|[^b]{2})/

    Join Date
    Nov 2001
    Location
    Somewhere in the great unknown
    Posts
    5,163
    Rep Power
    792
    AFIAK the # sign is required in these statements.
  4. #3
  5. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Feb 2003
    Location
    England
    Posts
    12
    Rep Power
    0
    I don't mind the # sign in the code.

    Its the speech marks I worry about.

    Or are the two related?
  6. #4
  7. /(bb|[^b]{2})/

    Join Date
    Nov 2001
    Location
    Somewhere in the great unknown
    Posts
    5,163
    Rep Power
    792
    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.
    i.e.
    Code:
    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
    Close #fp
  8. #5
  9. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Feb 2003
    Location
    England
    Posts
    12
    Rep Power
    0
    Thank you!

    It was the Write that was the problem.

    I just needed Print.
    Last edited by K-TC; March 14th, 2003 at 03:38 PM.
  10. #6
  11. No Profile Picture
    Contributing User
    Devshed Novice (500 - 999 posts)

    Join Date
    Apr 2002
    Posts
    693
    Rep Power
    26
    do you know there is an api to write in ini format? If you're interested I can provide some code.
  12. #7
  13. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Feb 2003
    Location
    England
    Posts
    12
    Rep Power
    0
    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!)
  14. #8
  15. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Mar 2003
    Location
    Mississippi
    Posts
    3
    Rep Power
    0
    try this:

    put your information in a variable

    info$ = "information"

    then

    Write #lngFile, info$

IMN logo majestic logo threadwatch logo seochat tools logo