wzbbbb Posted December 15, 2007 Share Posted December 15, 2007 Hi everyone, I am wondering why there is no function to open a file for both read and write? There must be a better way for this. Could you please how me ? Thanks ! Link to comment Share on other sites More sharing options...
Fossil Rock Posted December 16, 2007 Share Posted December 16, 2007 Straight out of the help file.FileOpen --------------------------------------------------------------------------------Opens a text file for reading or writing.FileOpen ( "filename", mode )ParametersFilename of the text file to open. Mode (read or write) to open the file in.Can be a combination of the following: 0 = Read mode 1 = Write mode (append to end of file) 2 = Write mode (erase previous contents) 4 = Read raw mode 8 = Create directory structure if it doesn't exist (See Remarks). 16 = Force binary(byte) reading and writing mode with FileRead and FileWrite 32 = Use Unicode UTF16 Little Endian mode when writing text with FileWrite and FileWriteLine (default is ANSI) 64 = Use Unicode UTF16 Big Endian mode when writing text with FileWrite and FileWriteLine (default is ANSI) 128 = Use Unicode UTF8 when writing text with FileWrite and FileWriteLine (default is ANSI)Both write modes will create the file if it does not already exist. The folder path must already exist (except using mode '8' - See Remarks).Your turn to RTFM. Agreement is not necessary - thinking for one's self is! Link to comment Share on other sites More sharing options...
wzbbbb Posted December 16, 2007 Author Share Posted December 16, 2007 Ok, I see, it can be a combination. Sorry, for the dumb question. Link to comment Share on other sites More sharing options...
Janus Posted December 16, 2007 Share Posted December 16, 2007 You don`t have to open the file to read from it or write to it. $line = FileReadLine("c:\file.txt") ; Read one line to $line FileWriteLine("c:\file.txt", "Line1"); writes one line to a file This is a nice think of Autoit3 Best Regard Janus S. Andersen Denmark Link to comment Share on other sites More sharing options...
Fossil Rock Posted December 16, 2007 Share Posted December 16, 2007 You don`t have to open the file to read from it or write to it.$line = FileReadLine("c:\file.txt") ; Read one line to $lineFileWriteLine("c:\file.txt", "Line1"); writes one line to a fileThis is a nice think of Autoit3Best RegardJanus S. AndersenDenmarkGo read the help file again nimrod. Agreement is not necessary - thinking for one's self is! Link to comment Share on other sites More sharing options...
Janus Posted December 17, 2007 Share Posted December 17, 2007 Hmm " Parameters filehandle The handle of a file, as returned by a previous call to FileOpen. Alternatively you may use a string filename as the first parameter. " Janus S. Andersen Denmark P.s. Type FileRead and the press F1. Read the letters in the box with "filehandle" paremeter 1. FileRead ( filehandle or "filename" [, count] ) . Help me out this is working in my place!!! . Read the help your self! NB: Autoit3 version: 3.2.10.0 Release (25 nov 2007). Is it a bug in my helpfile and my autoit3? Ping ! "Alternatively you may use a string filename as the first parameter. " Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted December 17, 2007 Moderators Share Posted December 17, 2007 Hmm " Parameters filehandle The handle of a file, as returned by a previous call to FileOpen. Alternatively you may use a string filename as the first parameter. " Janus S. Andersen Denmark P.s. Type FileRead and the press F1. Read the letters in the box with "filehandle" paremeter 1. FileRead ( filehandle or "filename" [, count] ) . Help me out this is working in my place!!! . Read the help your self! NB: Autoit3 version: 3.2.10.0 Release (25 nov 2007). Is it a bug in my helpfile and my autoit3? Ping ! "Alternatively you may use a string filename as the first parameter. " Out of curiousity... what do you think AutoIt does to the file in order to read it with FileReadLine/FileRead? Here's a hint... (It opens it ) Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
Janus Posted December 17, 2007 Share Posted December 17, 2007 It findes the filehandle for the file! And so! Parameters filehandle The handle of a file, as returned by a previous call to FileOpen. Alternatively you may use a string filename as the first parameter. Janus S. Andersen P.s. I am a ASM/C/C++/C# programmer and know my Win SDK! Lets stop this show. You can call Readline() / Writeline with a filehandle OR a string. Thats it! * Thnaks for all the nices word * Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now