CreateFile()


Creates a binary file.

Syntax

CreateFile(<cFile>, <nAttribute>) --> lResult

Arguments

<cFile> is the name of the file to create, including the file extension. A drive letter and/or path name may also be included as part of the filename. If the file already exists it is destroyed and replaced with a new empty file of zero length.

<nAttribute> Is one of the following binary file attributes:

0 - normal read/write file. (This is the default setting if not specified.)

1 - create as read only.

2 - create a hidden file.

3 - create a system file.

Returns

Returns TRUE if the create file operation was successful, otherwise FALSE.

Description

This is a low level function that either creates a new file or opens and truncates an existing file. If <cFile> does not exist, it is created. If it does exist and can be opened for writing, it is truncated to zero-length.

After the file is created, data can be written to it or it can be closed. A created file should never be left open.

generate/mistake3.gif

Example

If CreateFile("C:\CAPITAL\mydata.dat")

   WriteFile("C:\CAPITAL\mydaya.dat", "Hello World")

   CloseFile("C:\CAPITAL\mydata.dat")

Endif

____________________________

Related Topics:

Business Function List

CloseFile()

WriteFile()

OpenFile()

ReadFile()



CAPITAL VISUAL BUILDER