delorie.com/archives/browse.cgi | search |
X-Authentication-Warning: | delorie.com: mail set sender to djgpp-bounces using -f |
From: | Martin Ambuhl <mambuhl AT earthlink DOT net> |
Newsgroups: | comp.os.msdos.djgpp |
Subject: | Re: About chdir() |
Date: | Thu, 30 Sep 2004 15:07:17 -0400 |
Lines: | 35 |
Message-ID: | <2s33rfF1gghltU1@uni-berlin.de> |
References: | <bd472b6d DOT 0409300315 DOT b599807 AT posting DOT google DOT com> |
Mime-Version: | 1.0 |
X-Trace: | news.uni-berlin.de 4xPSeaEtPkDIZMv6V++NVgzgrpmzsO+wtsUqUEZZbVMMAxYbHM |
User-Agent: | Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.2) Gecko/20040803 |
X-Accept-Language: | en-us, en, de, fr, ru, zh, ja |
In-Reply-To: | <bd472b6d.0409300315.b599807@posting.google.com> |
To: | djgpp AT delorie DOT com |
DJ-Gateway: | from newsgroup comp.os.msdos.djgpp |
Reply-To: | djgpp AT delorie DOT com |
Errors-To: | nobody AT delorie DOT com |
X-Mailing-List: | djgpp AT delorie DOT com |
X-Unsubscribes-To: | listserv AT delorie DOT com |
Vyom wrote: > I have a question regarding chdir() function, > > If the file name contains a space, how should the argument > be passed to chdir function? > > I tried including quotes like > chdir ("d:\\\"\program files""); > > But I get "Parameter Format Not Correct" 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; } /* vim:set ts=4 et tw=72: */
webmaster | delorie software privacy |
Copyright © 2019 by DJ Delorie | Updated Jul 2019 |