Common file services

Below are the main services for managing files when generating documents in the target project.

Declaration:

paFileOpenWrite - Open any file in the target project for writing
paFileOpenWriteProgramSrc - Open the source file of a POU for writing
paFileOpenWriteProgramDef - Open the definitions file of a POU for writing
paFileClose - Close an open file

Below are details about these functions:

paFileOpenWrite - Open any file in the target project for writing

FID := paFileOpenWrite (PREFIX, SUFFIX)

Parameters:

PREFIX : STRING; File prefix
SUFFIX : STRING; File suffix
FID : DINT; File identifier or 0 if fail

Description:

This function opens a target project file for writing. It should normally not be used as dedicated file open functions are available for most of possible project documents.

This functions removes the contents of the file if it already exist.

When written, the file must be closed by calling the paFileClose function.

other functions

paFileOpenWriteProgramSrc - Open a POU source file for writing

FID := paFileOpenWriteProgramSrc (NAME)

Parameters:

NAME : STRING; Program name
FID : DINT; File identifier or 0 if fail

Description:

This function opens for writing the file that contains the source code of a program, sub-program or UDFB. Then you should use the appropriate file writing functions according to the language of the specified POU.

This functions removes the contents of the file if it already exist.

When written, the file must be closed by calling the paFileClose function.

other functions

paFileOpenWriteProgramDef - Open a POU definitions file for writing

FID := paFileOpenWriteProgramDef (NAME)

Parameters:

NAME : STRING; Program name
FID : DINT; File identifier or 0 if fail

Description:

This function opens for writing the file that contains the local definitions of a program, sub-program or UDFB. Then you should use the text file writing functions to fill the file.

This functions removes the contents of the file if it already exist.

When written, the file must be closed by calling the paFileClose function.

other functions

paFileClose - Close an open file

OK := paFileClose (FID)

Parameters:

FID : DINT; File identifier returned by any file open function

Description:

This function closes a file open by any of available file open functions.

other functions