Previous Topic Next topic Print topic


CBL_GET_CURRENT_DIR

Returns the current directory.

Syntax:

call "CBL_GET_CURRENT_DIR" using by value flags
                           by value       name-length
                           by reference   directory-name
                           returning      status-code

Parameters:

  Using call prototype (see Key) Picture
flags cblt-os-flags pic x(4) comp-5

or

pic x(8) comp-5 (64-bit native programs only)

name-length cblt-os-size pic x(4) comp-5

or

pic x(8) comp-5 (64-bit native programs only)

directory-name pic x(n). pic x(n).
status-code See Library Routines - Key.

On Entry:

flags
Reserved. Must be set to zero.
name-length
The size, in bytes, of the directory-name parameter. This parameter must be at least as big as the longest directory name that can be returned.

On Exit:

directory-name
Contains the current working directory in space-terminated format. If the directory name contains embedded spaces then it will be returned delimited by a pair of double quotes. This parameter must be large enough to also hold these quotes.
status-code
A return code:
0 Success. directory-name contains the current working directory.
128 The size of directory-name specified by name-length is not large enough to hold the name of the current working directory.
129 The flags parameter is not set to zero.

Comments:

This routine ensures that name-length is at least as long as the current directory name that is to be returned. If it is not, the routine returns with status-code set to 128. If the flags parameter is not set to zero the routine returns with status-code set to 129.

The name-length parameter is not checked by this routine. It is the responsibility of the calling program to specify a valid name-length and directory-name combination (that is, to ensure that directory-name is at least name-length bytes long). Use the BY VALUE LENGTH OF directory-name SIZE 4" construct to pass the name-length parameter.

Previous Topic Next topic Print topic