delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2004/10/01/01:46:44

X-Authentication-Warning: delorie.com: mail set sender to djgpp-bounces using -f
From: vyom2k4 AT yahoo DOT com (Vyom)
Newsgroups: comp.os.msdos.djgpp
Subject: Re: About chdir()
Date: 30 Sep 2004 22:42:50 -0700
Organization: http://groups.google.com
Lines: 39
Message-ID: <bd472b6d.0409302142.21a9139f@posting.google.com>
References: <bd472b6d DOT 0409300315 DOT b599807 AT posting DOT google DOT com> <2s33rfF1gghltU1 AT uni-berlin DOT de>
NNTP-Posting-Host: 203.126.136.220
X-Trace: posting.google.com 1096609371 30660 127.0.0.1 (1 Oct 2004 05:42:51 GMT)
X-Complaints-To: groups-abuse AT google DOT com
NNTP-Posting-Date: Fri, 1 Oct 2004 05:42:51 +0000 (UTC)
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

> 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?

I tried running this program
I got the output:

No error reported from chdir.
current working directory is d:/program files

in command.com, but when run in cmd.exe there is no output at all, 
why does that happen?


--
Vyom

- Raw text -


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