Mail Archives: djgpp/2002/12/16/13:44:50
> 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");
- Raw text -