Creates a directory.

Syntax

int f_mkdir(
  const char *path
);

Parameters

path
[in] A pointer to a string that represents the path of a directory.

Return value

Returns 0 if the function succeeds, non-zero value otherwise.

Remarks

Creates a directory with the name specified by path.

Requirements

Header file:
lib.h
Library file:
libSTARTUPOPH5000.a

Sample

#include <stdio.h>
#include "lib.h"

void main(void)
{
    // Current working directory(CWD) = "1:/"

    f_mkdir("1:/DIR1");       // absolute path: Create "1:/DIR1"
    f_mkdir("1:/DIR1/DIR2");  // absolute path: Create "1:/DIR1/DIR2"

    f_mkdir("DIR3");          // relative path: Create "1:/DIR3"

    f_chdir("DIR3");          // relative path: Change CWD to "1:/DIR3"

    f_mkdir("DIR4");          // relative path: Create "1:/DIR3/DIR4"

    remove("DIR4");           // relative oath: Delete "1:/DIR3/DIR4"

    f_chdir("1:/");           // absolute path: Change CWD to"1:/"

    remove("1:/DIR3");        // absolute path: Delete "1:/DIR3"

    f_chdir("/DIR1");         // absolute path without drive identifier: Change CWD to "1:/DIR1"

    remove("DIR2");           // relative path: Delete "1:DIR1/DIR2"

    f_chdir("/");             // absolute path without drive identifier: Change CWD to "1:/"

    remove("/DIR1");          // absolute path without drive identifier: Delete "1:DIR1"

    while(1){
        Idle();
    }
}

Last updated: 2020/11/15