Jump to content

FileOpen or FileWriteLine is not working...


Recommended Posts

This is my code:

$file = FileOpen(@MyDocumentsDir & "sfp.ini", 1)

; Check if file opened for writing OK
If $file = -1 Then
    MsgBox(0, "Error", "Unable to open file.")
    Exit
EndIf

FileWriteLine($file, "Line1")
FileWriteLine($file, "Line2" & @CRLF)
FileWriteLine($file, "Line3")

FileClose($file)

I went to My Documents and it's not showing up, although I get no error message.

Link to comment
Share on other sites

@MyDocuments, as well as other directory macros, do not contain a \ on the end. You have to add it yourself. "\sfp.ini"

The file you made was at "C:\Documents and Settings\[user]\My Documentssfp.ini". I assume you use XP because Vista would have popped up on UAC trying to do something like that.

Edited by Richard Robertson
Link to comment
Share on other sites

  • Developers

You forgot a slash between the directoryname and the filename on your fileopen() statement so guess you are looking on the wrong place?

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...