Sign in to follow this  
Followers 0
miketh2005

FileOpen or FileWriteLine is not working...

4 posts in this topic

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.

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

@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

Share this post


Link to post
Share on other sites

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


Visit the SciTE4AutoIt3 Download page for the latest versions        Beta files                                                          Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

Oh, ok, thanks, guys >_

Share this post


Link to post
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
Sign in to follow this  
Followers 0