Jump to content

How can I open a file for both read and write?


wzbbbb
 Share

Recommended Posts

Straight out of the help file.

FileOpen

--------------------------------------------------------------------------------

Opens a text file for reading or writing.

FileOpen ( "filename", mode )

Parameters

Filename 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!

My-Colors.jpg

cuniform2.gif

Link to comment
Share on other sites

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

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

Go read the help file again nimrod.

Agreement is not necessary - thinking for one's self is!

My-Colors.jpg

cuniform2.gif

Link to comment
Share on other sites

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

  • Moderators

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

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

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...