OpenFile()


Opens a file in binary mode.

Syntax

OpenFile(<cFile>, [<nAccess>], [<nShared>]) --> lResult

Arguments

<cFile> --> The name of the file to open including the path and drive letter if applicable.

<nAccess> --> Specifies the access mode the file is opened in.

0 - open for reading (this is the default mode if no access mode is specified).

1 - open for writing.

2 - open for reading or writing.

<nShared> --> Specifies the shared mode the file is opened in. This determines how other processes may access this file while it is opened by this function.

0 - normal (this is the default shared mode if no share mode is specified).

1 - exclusive use (no other process may access it)

2 - prevent others from writing

3 - prevent others from reading

4 - allow others to read and write (shared mode).

Returns

Returns logical TRUE if the file was successfully opened, otherwise FALSE if there was a problem with the open request: such as the file not existing or already in use by another application.

Description

This function opens any file in binary mode.

generate/mistake2.gifA file opened using OpenFile() must also be closed using CloseFile().

Example

cFile := "C:\CAPITAL\Myfile.dat"

If OpenFile(cFile)

   WriteFile(cFile, "Hello World")

   CloseFile(cFile)

Endif

____________________________

Related Topics:

Business Function List

CloseFile()

OpenFile()

WriteFile()



CAPITAL VISUAL BUILDER