Date: Mon, 16 Dec 2002 20:43:04 +0300 From: "Eli Zaretskii" Sender: halo1 AT zahav DOT net DOT il To: djgpp AT delorie DOT com Message-Id: <2950-Mon16Dec2002204303+0200-eliz@is.elta.co.il> X-Mailer: emacs 21.3.50 (via feedmail 8 I) and Blat ver 1.8.9 In-reply-to: (065211@bud.cc.swin.edu.au) Subject: Re: back slash compatibility prob References: 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 > From: 065211 AT bud DOT cc DOT swin DOT edu DOT au (MURPHY, Jeremy W) > Newsgroups: comp.os.msdos.djgpp > Date: 16 Dec 2002 11:47:49 GMT > > I notice that if TMPDIR="c:/djgpp/tmp", it comes up as "c:\djgpp\tmp" in > a program if you use getenv() or tmpnam(), which I assume is the correct > behaviour, it makes sense. You didn't tell the whole story (e.g., how _exactly_ did you set TMPDIR, with what command?), so I'll have to guess. My guess is that you've set it inside Bash, but did not tell Bash to export its value to programs Bash invokes. So Bash passes the programs the original value of TMPDIR as it saw it outside Bash. > Problem is that I'm compiling and running some C which had UNIX in mind, > and so is using the result of getenv() as part of a call to system(), and > the backslashes are getting eaten up, or something. > So calling system("uname -s > c:\djgpp\tmp/dj200000 2>&1") is resulting > in: > c:\djgpp\tmp/dj400000: c:djgpptmp/dj200000: No such file or directory > (ENOENT) If the above call to `system' is a literal quotation from your program's source, then the problem is that you must double every backslash in a C string, like so: system("uname -s > c:\\djgpp\\tmp/dj200000 2>&1");