_chdir

 

Description

change the current working directory to the specified path

Syntax

int _chdir( const char * lpcszPath )

Parameters

lpcszPath
[input] Path of new working directory.

Return

0 if successful. A return value of -1 indicates that the specified path could not be found

Examples

EX1

void    chdir_ex1()
{
    string        strNewCurrentDir = "c:\\";
    if (0 == _chdir(strNewCurrentDir))
    {
        // If it succeded, display the new current directory:
        char        szcurDirectory[MAXFULLPATH];
        if ( _getcwd(szcurDirectory, MAXFULLPATH) != NULL )
        {
            out_str(szcurDirectory);
        }
    }
}

Remark

Change the current working directory.

See Also

header to Include

origin.h

Reference