Re: Changing directories from a C console program

From: Alan Balmer (albalmer_at_att.net)
Date: 08/27/04


Date: Fri, 27 Aug 2004 08:34:55 -0700

On 26 Aug 2004 17:57:50 -0700, oddstray@gmail.com (oddstray) wrote:

>
>I'm using WinXP. I wrote a short C utility in which I want to change
>directories and run programs. When I use the system() method and pass
>in the same command that works in a cmd.exe session, it claims "Unable
>to locate the directory". This happens for directories with and
>without spaces in their names. Can anyone tell me what's wrong?
>Thanks.

Off topic here. Try a Windows programming group. However, I note that
you have one method which works - why not use it?

{OT} I wouldn't expect the system calls to work. You spawn a shell,
change directory in that shell, then close the shell and return to the
program you spawned it from. {/OT]

-- 
Al Balmer
Balmer Consulting
removebalmerconsultingthis@att.net


Relevant Pages

  • =?iso-8859-1?q?Bestimmt_v=F6llig_einfach,_bin_aber_zu_blind...?=
    ... mal benötigtes Batchfile als Admin starten können, ... WinXP diese Option wohl gar nicht an. ... Jetzt muss ich der Shell "nur noch" meine bat-Datei ...
    (de.comp.security.misc)
  • Re: Problem with ICS
    ... > Anyone that can pay for WinXP can shell out a little for a proper ... > modem. ...
    (alt.os.linux)
  • Re: Why do games assume...
    ... DOS shell? ... The command shell in WinXP still looks remarkably like the old dos ...
    (comp.sys.ibm.pc.games.strategic)
  • Re: Problem with ICS
    ... > Anyone that can pay for WinXP can shell out a little for a proper ... I'd rather spend my money on a proper modem than WinXP though. ...
    (alt.os.linux)
  • Re: expect question - why spawn a separate shell?
    ... Bruce Hartweg wrote: ... If the expect script relies on seeing the ... > prompt to know when commands are finished, then you need to have the shell ... > so there are prompts to run - if you spawn your apps directly, ...
    (comp.lang.tcl)