delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2004/09/30/08:15:43

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()
Supersedes: <2s296mF1fic9vU1 AT uni-berlin DOT de>
Date: 30 Sep 2004 12:05:16 GMT
Lines: 30
Message-ID: <2s2b3sF1fugmvU2@uni-berlin.de>
References: <bd472b6d DOT 0409300315 DOT b599807 AT posting DOT google DOT com>
X-Trace: news.uni-berlin.de WI1AYy94a+8b/S0wj+9FVw9g76dAm88PmqXW6gKJhscupxDOcHjqbBbLfw
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:
> I have a question regarding chdir() function,

> If the file name contains a space, how should the argument 
> be passed to chdir function?

Just as it is.  No extra quoting or anything:

> I tried including quotes like
> chdir ("d:\\\"\program files"");

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

or, if you hate typing any more backslashes than strictly needed

        chdir ("d:/program files");

Spaces are not a problem for C programs, which would have to be
treated specially.  They are a problem only for the command line shell
(command.com, cmd.exe), because that would normally assume spaces to
separate arguments.

> Also is there any difference in running the program in 
> cmd.exe and command.com.

Not as far as this aspect concerned.

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