www.delorie.com/djgpp/doc/libc/libc_92.html   search  
libc.a reference

[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

chdir

Syntax

 
#include <unistd.h>

int chdir(const char *new_directory);

Description

This function changes the current directory to new_directory. If a drive letter is specified, the current directory for that drive is changed and the current disk is set to that drive, else the current directory for the current drive is changed.

Return Value

Zero if the new directory exists, else nonzero and errno set if error.

Portability

ANSI/ISO C No
POSIX 1003.2-1992; 1003.1-2001

Example

 
if (chdir("/tmp"))
  perror("/tmp");


  webmaster   donations   bookstore     delorie software   privacy  
  Copyright 2004   by DJ Delorie     Updated Apr 2004