fsDirChange (Function)

Top  Previous  Next

Architecture:

X32 / NX32 / NX32L

Device support:

All

Firmware version:

1.00 / 1.00.00


This function changes the working directory and/or the current media.

To change the media, insert the drive in the path.

 

Note: the change will only take effect for the calling thread. The working directory for all other threads is not changed.

 

 

Input:

path : STRING

Path of the new directory. Both absolute and relative paths are allowed.

 

Returns: INT

0

- Directory changed.

-1

- Media not open.

-2

- Media is not formatted.

-4

- Name of directory is invalid.

-5

- Directory does not exists.

-16

- Media not present.

-17

- Media communication error (card not supported).

-22

- Media is busy.

-24

- Unknown file system.

 

 

Declaration:

FUNCTION fsDirChange : INT;
VAR_INPUT
  path : STRING;
END_VAR;

 

 

Example:

INCLUDE rtcu.inc
 
PROGRAM test;
VAR
  rc : INT;
END_VAR;
 
BEGIN
  ...
  // Change directory
  rc := fsDirChange(path := "..\Docs\logs");
  IF rc = 0 THEN
     ...
  ELSE
    // Failed to change directory
     ...
  END_IF;
  ...
  // Change media
  rc := fsDirChange(path := "B:\");
  ...
END;
 
END_PROGRAM;