Example: mkdir

The following example uses mkdir to create a new directory, xyz. It then moves to the new directory.

    #ifdef unix
        char new_dir[] = "/tmp/xyz";
    #else
        char new_dir[] = "C:\\xyz";
    #endif
    // Create a directory under root called xyz and make it the current dir 
    if (mkdir(new_dir)) {
        lr_output_message ("Create directory %s failed", new_dir);
        return -1;
    }
    else
         lr_output_message ("Created new directory %s", new_dir);
    if (chdir(new_dir)) {
        lr_output_message ("Unable to change to dir %s", new_dir);
        return -1;
     }
    else
        lr_output_message ("Changed to new dir %s", new_dir);
        
    return 0;
Example: Output:
Action.c(16): Created new directory C:\xyz
Action.c(24): Changed to new dir C:\xyz