FC_Open_WriteFile - General Information
Type: |
Function |
Available as of: |
SystemInterface_1.32.6.0 |
Versions: |
Current version |
File write open. The file is opened with writing- and reading rights.
NOTE: The operating system on the PacDrive III controller allows opening a file multiple times at the same time. When opening a file the complete content of the file is loaded into the memory and referenced via a file ID.
Via the file ID the content can be processed and the file can be closed.
When closing the file the (maybe changed) content is transferred to the file on the drive from the memory.
NOTICE |
LOSS OF DATA |
Do not open a file multiple times. |
Failure to follow these instructions can result in equipment damage. |
This function opens a file i_sFilename for write access. The writing- or reading indicator is set to the file end.
The standard device is "ide0:". i_sFilename can be a short standard name or a complex name. A default name consists of one to eight characters (A ... Z, 0 ... 9). The device name "ide0:" and the file name extension ".dat" are appended by the system. A complex name consists of device name, file name, and file name extension.
oIf the file does not exist, the function creates it.
oIf the file exists, the content is deleted.
NOTE: The processing time of this function is a few hundred milliseconds. This is why the times for the cycle check of the task in which this function is performed should be increased one-time. For example FC_CycleCheckTimeSet(500, 2).
If you try to open a system file that is not editable with this function, then you get -5 as the return value (see below). The system file is not being opened.
Also refer to controller-specific system files and general system files.
Input |
Data type |
Description |
---|---|---|
i_sFilename |
STRING[80] |
Name of the file in which is to be written |
Data type |
Description |
---|---|
DINT |
FileID: Indication number of the opened file (> 0) -1: File could not be opened (system error detected) -2: Too many files open -5: Trying to open a system. |