X-Authentication-Warning: delorie.com: mail set sender to djgpp-bounces using -f From: Martin Ambuhl 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: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit 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: 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 Precedence: bulk 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 #include 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: */