Sunteți pe pagina 1din 7

Library Description:

CoDeSys V 3.x
SysDir.library

Document Version 1.0


libdoc_e.dot / V1.0

3S - Smart Software Solutions GmbH Page 1 of 7


SysDir_V3x_E.doc
Library SysDir.library

CONTENT

1 OVERVIEW 3

2 LIBRARY MODULES 4
2.1 SysDirCreate 4
2.2 SysDirOpen 4
2.3 SysDirRead 4
2.4 SysDirDelete 5
2.5 SysDirRename 5
2.6 SysDirGetCurrent 5
2.7 SysDirSetCurrent 6
2.8 SysDirClose 6
2.9 DirFileTime 6
2.10 DirInfo 6

CHANGE HISTORY 7
libdoc_e.dot / V1.0

3S - Smart Software Solutions GmbH Page 2 of 7


SysDir_V3x_E.doc
Library SysDir.library

1 Overview

Hinweis: Es hngt vom verwendeten Zielsystem ab, welche Systembibliotheken im Steuerungsprogramm verwendet
werden knnen.

If supported by the runtime system, you can use the functions of this library to handle a file
directory system on the target system. Entries of the directory can be read and modified. The
execution is synchronous.

The functions:

SysDirOpen
SysDirCreate
SysDirRead
SysDirRename
SysDirSetCurrent
SysDirGetCurrent
SysDirClose
SysDirDelete

Structures used by the functions:

DirFileTime
DirInfo
libdoc_d.dot / V1.0

3S - Smart Software Solutions GmbH Seite 3 von 7


SysDir_V3x_E.doc
Library SysDir.library

2 Library modules

2.1 SysDirCreate
This function serves for creating a directory.

The return value of type UDINT contains an error code which tells about the success of the
operation. See document Runtime Error Codes.
Input-Variable Data type Description

szDir REFERENCE TO Directory name


STRING

2.2 SysDirOpen
This function can be used to open a directory in order to read the directory entries (files,
subdirectories) via function SysDirRead.

To close the directory, SysDirRead must be called until it returns 0.

The return value of type UDINT is a handle, which is required by function SysDirRead as an
input. In error case an invalid handle (-1) will be returned.
Input-Variable Data type Description

szDir REFERENCE TO Name of the directory to be opened


STRING
szDirEntry REFERENCE TO First entry (subdirectory or file) of the opened
STRING directory
diMaxDirEntry DINT Maximum length of the entry specifiec in szDirEntry

pDirInfo POINTER TO Pointer on structure DirInfo (see chapt. 2.10),


DirInfo containing information on the opened directory
pResult POINTER TO Pointer on an error code, giving information on the
UDINT success of the operation. See document Runtime
Error Codes.

2.3 SysDirRead
This function serves for reading directory entries.

Each time the function is called, one entry of the directory will be read. As long as "1" is
returned, a further entry is in the directory. Thus for reading all entries the function must be
called repeatedly until "0" is returned. In this case, the directory is closed and the handle is
not valid any more. In every case, the function has to be called until it returns 0 to close the
directory.

The information on the particular entries will be written to structure DirInfo.


libdoc_d.dot / V1.0

Input-Variable Data type Description

hDir UDINT Handle of the directory; returned by function


SysDirOpen, which was called before in order to open
the directory.

3S - Smart Software Solutions GmbH Seite 4 von 7


SysDir_V3x_E.doc
Library SysDir.library

Input-Variable Data type Description

szDirEntry STRING Name of an entry in the directory. Can be a file or


another directory.
dMaxDirEntry DINT Maximum length of the string entry which after
reading will be written to szDirEntry.
pDirInfo POINTER TO Pointer on structure DirInfo, will be filled with
DirInfo information on the read entry. You can enter "0" here
if the information should not be read.

2.4 SysDirDelete
This function can be used to delete a directory.

The return value of type UDINT contains an error code which tells about the success of the
operation. See document Runtime Error Codes.
Input-Variable Data type Description

szDir STRING Name of the directory to be deleted

2.5 SysDirRename
This function can be used to rename a directory.

The return value of type UDINT contains an error code which tells about the success of the
operation. See document Runtime Error Codes.
Input-Variable Data type Description

szOldDirName STRING Old directory name

szNewDirName STRING New directory name

2.6 SysDirGetCurrent
This function returns the name of the current directory.

The return value of type UDINT contains an error code which tells about the success of the
operation. See document Runtime Error Codes.
Input-Variable Data type Description

szDir REFERENCE TO The name of the current directory will be written to this
STRING string.
dMaxDirLen DINT Maximum length of the string written to szDir
libdoc_d.dot / V1.0

3S - Smart Software Solutions GmbH Seite 5 von 7


SysDir_V3x_E.doc
Library SysDir.library

2.7 SysDirSetCurrent
This function sets the current directory.

The return value of type UDINT contains an error code which tells about the success of the
operation. See document Runtime Error Codes.
Input-Variable Data type Description

szDir STRING Name of the directory, which should be set as current


one

2.8 SysDirClose
This function closes the directory which has been opened via SysDirOpen.

The return value of type UDINT contains an error code which tells about the success of the
operation. See document Runtime Error Codes.
Input-Variable Data type Description

hDir UDINT Handle of the directory, returned by function


SysDirOpen

2.9 DirFileTime
This structure contains information on date and time of the last access and last modification of
a directory entry. It is used by structure DirInfo. The data are given in IEC time format.
Structure component Data type Description

ulCreation UDINT Creation date

ulLastAccess UDINT Date of last access

ulLastModification UDINT Date of last modification

2.10 DirInfo
This structure contains information on a directory entry which is read via functions
SysDirRead.
Strukturkomponente Data type Description

tDirFileTime DIRFILETIME Structure with information on date and time of the


creation, of the last access and last modification of the
directory entry

ulSize UDINT Size of the directory entry

diDirectory DINT TRUE, if the entry is a directory


FALSE, if the entry is a file
libdoc_d.dot / V1.0

3S - Smart Software Solutions GmbH Seite 6 von 7


SysDir_V3x_E.doc
SysDir.library

Change History
Version Description Date

1.0 Translation and Release according to German version 1.0 19.07.2007


libdoc_d.dot / V1.0

3S - Smart Software Solutions GmbH Seite 7 von 7


SysDir_V3x_E.doc

S-ar putea să vă placă și