wFSgetcwd Function

MDD File System Interface Library

MDDFS Interface Library Help
wFSgetcwd Function
C
char * wFSgetcwd(
    unsigned short int * path, 
    int numbchars
);
Description

Get the current working directory path in UTF16 format. The FSgetcwd function will get the name of the current working directory and return it to the user. The name will be copied into the buffer pointed to by 'path,' starting at the root directory and copying as many chars as possible before the end of the buffer. The buffer size is indicated by the 'numchars' argument. The first thing this function will do is load the name of the current working directory, if it isn't already present. This could occur if the user switched to the dotdot entry of a subdirectory immediately before calling this function. The function will then copy the current working directory name into the buffer backwards, and insert a backslash character. Next, the function will continuously switch to the previous directories and copy their names backwards into the buffer until it reaches the root. If the buffer overflows, it will be treated as a circular buffer, and data will be copied over existing characters, starting at the beginning. Once the root directory is reached, the text in the buffer will be swapped, so that the buffer contains as much of the current working directory name as possible, starting at the root.

Preconditions

None

Parameters
Parameters 
Description 
path 
Pointer to the array to return the cwd name in 
numchars 
Number of chars in the path 
Return Values
Return Values 
Description 
char * 
The cwd name string pointer (path or defaultArray) 
NULL 
The current working directory name could not be loaded. 
Side Effects

The FSerrno variable will be changed

Remarks

None

Microchip MDD File System Interface 1.4.2 - [Oct 15, 2012]
Copyright © 2012 Microchip Technology, Inc.  All rights reserved.