delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2004/10/01/06:00:37

X-Authentication-Warning: delorie.com: mail set sender to djgpp-bounces using -f
From: Hans-Bernhard Broeker <broeker AT physik DOT rwth-aachen DOT de>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: About chdir()
Date: 1 Oct 2004 09:46:56 GMT
Lines: 37
Message-ID: <2s4ncgF1gobiaU1@uni-berlin.de>
References: <bd472b6d DOT 0409300315 DOT b599807 AT posting DOT google DOT com> <2s33rfF1gghltU1 AT uni-berlin DOT de> <bd472b6d DOT 0409302142 DOT 21a9139f AT posting DOT google DOT com>
X-Trace: news.uni-berlin.de MfW+w4AjBsmouIyIAlLTxgCafp1bPSImuxGjBjE0STwxCF8FGDPCO+ilyA
X-Orig-Path: not-for-mail
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

Vyom <vyom2k4 AT yahoo DOT com> wrote:
> > You're trying too hard:
> > 
> > #include <stdio.h>
> > #include <unistd.h>
> > 
> > int main(void)
> > {
> >      char pwd[FILENAME_MAX];
> > 
> >      if (chdir("d:/program files"))
> >          perror("d:/program files");
> >      else
> >          printf("No error reported from chdir.\n");
> >      if (getcwd(pwd, sizeof pwd))
> >          printf("current working directory is %s\n", pwd);
> >      else
> >          perror("getcwd failed.");
> >      return 0;
> > }
> > 
> > 

> Thank you all,

> Does it mean chdir doesn't work with back slash
> at all or only when there are spaces?

None of those.  As I wrote before 

	chdir("d:\\program files");

should work just as nicely.

-- 
Hans-Bernhard Broeker (broeker AT physik DOT rwth-aachen DOT de)
Even if all the snow were burnt, ashes would remain.

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019