From: "A. Sinan Unur" Newsgroups: comp.os.msdos.djgpp Subject: Re: back slash compatibility prob Date: 16 Dec 2002 13:20:18 GMT Organization: Cornell University Lines: 54 Sender: asu1 AT cornell DOT invalid (on pool-141-149-208-61.syr.east.verizon.net) Message-ID: References: NNTP-Posting-Host: pool-141-149-208-61.syr.east.verizon.net X-Trace: news01.cit.cornell.edu 1040044818 19415 141.149.208.61 (16 Dec 2002 13:20:18 GMT) X-Complaints-To: usenet AT news01 DOT cit DOT cornell DOT edu NNTP-Posting-Date: 16 Dec 2002 13:20:18 GMT User-Agent: Xnews/5.04.25 To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com 065211 AT bud DOT swin DOT edu DOT au (MURPHY, Jeremy W) wrote in news:atkeh5$1fh$1 AT c3p0 DOT cc DOT swin DOT edu DOT au: > Howdy, > > not sure if my previous post went through, but I've refined my > question anyway, so forgive me for repeating myself. > > I haven't programmed in djgpp for a while, so I'm a bit out of touch > with its idiosyncrasies. > > 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. > > 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) you may want to look at the documentation for _fixpath. i don't know if the value of `_crt0_startup_flags' has any effect on how environment strings are read, although I suspect not. C:\Dload\misc>cat eee.c #include #include #include int main(void) { char fixed_path[FILENAME_MAX]; puts(getenv("TEMP")); _fixpath(getenv("TEMP"), fixed_path); puts(fixed_path); return 0; } C:\Dload\misc>gcc -Wall eee.c -o eee.exe C:\Dload\misc>eee C:\WINDOWS\TEMP c:/WINDOWS/TEMP -- A. Sinan Unur asu1 AT c-o-r-n-e-l-l DOT edu Remove dashes for address Spam bait: mailto:uce AT ftc DOT gov