From: "A. Sinan Unur" Newsgroups: comp.os.msdos.djgpp Subject: Re: DJGPP Library function System(); problem under WIN NT Date: 13 Jun 2003 15:09:25 GMT Organization: Cornell University Lines: 74 Sender: asu1 AT cornell DOT invalid (on 128.253.251.165) Message-ID: References: NNTP-Posting-Host: 128.253.251.165 X-Trace: news01.cit.cornell.edu 1055516965 18388 128.253.251.165 (13 Jun 2003 15:09:25 GMT) X-Complaints-To: usenet AT news01 DOT cit DOT cornell DOT edu NNTP-Posting-Date: 13 Jun 2003 15:09:25 GMT User-Agent: Xnews/5.04.25 X-Face: #0:Oa+WV[,\dU+SJ\X%#!MhGkG;vsj^Tzl1KJHck]V;S8u}yvJp~GpGgD.mLo)IY,&yDRM1dV3z'Y'8D=+Y7k[|[~mGbV(<(8Im%IhZkC9.A.&]TGcwX9GKGgA,lqReCST$aDsGKy#zU~laO|oJiD$e"6&_tzrxT}K,X_e,FC&}P8J"x~ii,lr6)L}=tZI#cNU,7u]J"TLISliDF2pmIKR`ulX=X-sB2aM?f4wIG5Z_nXceH~5}E*t+vx!unlkVJ7]57x`%S1\gR{.1_^Gu2L'am[/=c]'7Hj1l^Yx!nCe40dFkW To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com "Shete, Bahubali (icd) USX" wrote in news:A39EEA2C33B08346A5D92E8DC6BD6B540723ECEE AT exchange DOT moog DOT com: > Hi, > > I have a DOS utility which was originally built under TC on DOS. > Recently we moved over to DJGPP (GCC under DOS). I have 2 problems: > > 1. the tmpnam() function with DJGPP returns filenames with '/' as > separators in the path for the temp. file name. Where as DOS doesn't > like it. > 2. Once I changed all the '/' to '\' then, I have another problem. > With these temp file names, I do a sorting using DOS sort.exe via > system() function call to DOS shell. This works fine under WIN 2000. > But fails under WIN NT. I tried to play with the _system_flags bits in > stdlib.h. But could not get it to work. > > Any clues? It would help to see a small amount of code exhibiting the problem and sample output. Also, do you know which sort.exe you are using? The one from GNU Textutils or the one that comes with Windows? Or, do you have textutils installed on one machine and not the other? C:\Dload\misc>cat sortwin.c #include #include #define SORT_PROGRAM "c:/windows/system32/sort.exe" int main(void) { FILE *f; char fname[L_tmpnam]; int ret; if((f = fopen(tmpnam(fname),"w")) == NULL) { fprintf(stderr, "Error opening %s for writing\n", fname); ret = EXIT_FAILURE; } else { int i; char cmdline[1024]; for(i = '9'; i >= '0'; --i) { fprintf(f, "%c\n", i); } fclose(f); sprintf(cmdline, SORT_PROGRAM " %s", fname); fprintf(stderr, "Run: %s\n", cmdline); ret = system(cmdline); } return ret; } C:\Dload\misc>gcc -Wall -O2 sortwin.c -o sortwin.exe C:\Dload\misc>sortwin Run: c:/windows/system32/sort.exe C:\DOCUME~1\asu1\LOCALS~1\Temp/dj500000 0 1 2 3 4 5 6 7 8 9 -- 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