fsDirCreate (Function)

Top  Previous  Next

Architecture:

X32 / NX32 / NX32L

Device support:

All

Firmware version:

1.00 / 1.00.00


This creates a new directory.

 

The fsDirCreate function does not work recursively and only tries to create the directory. If any of the directories in the path (if absolute) does not exist, the function will fail.

 

 

Input:

name : STRING

Name of the directory to create. Both absolute and relative paths are allowed.

 

Returns: INT

0

- Directory created.

-1

- Media not open.

-2

- Media is not formatted.

-3

- Path of the new directory is invalid.

-4

- Name of the new directory is invalid.

-6

- Directory already exists.

-7

- Media is full.

-16

- Media not present.

-17

- Media communication error (card not supported).

-22

- Media is busy.

-23

- Media is write protected.

-24

- Unknown file system.

 

Declaration:

FUNCTION fsDirCreate : INT;
VAR_INPUT
  name : STRING;
END_VAR;

 

 

Example:

INCLUDE rtcu.inc
 
PROGRAM test;
VAR
  rc : INT;
END_VAR;
 
BEGIN
  ...
  // Create new directory
  rc := fsDirCreate(name := "\data\gps");
  IF rc = 0 THEN
     ...
  ELSE
    // Failed to create directory
     ...
  END_IF;
  ...
END;
 
END_PROGRAM;