Date: Sun, 14 Sep 1997 11:42:28 -0700 (PDT) Message-Id: <199709141842.LAA12548@adit.ap.net> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" To: ao950 AT FreeNet DOT Carleton DOT CA (Paul Derbyshire), djgpp AT delorie DOT com, lchandar AT mindspring DOT com From: Nate Eldredge Subject: Re: Please Help: Printf problem argv[] issues. LFN? Precedence: bulk At 05:17 9/13/1997 GMT, Paul Derbyshire wrote: > > >"Joshua Cannon Butcher" (lchandar AT mindspring DOT com) writes: >> I am writing a command line DOS utility and use a FOR command for = >> several tasks. While the for command is executing, I am using a printf = >> statement to update progress. This code was taken directly from a = >> similar utility I wrote with Borland C++. the printf in the for command = >> DOS NOT update on the screen until the for command is finished = >> executing, and all the progress shows up at once. Why? Also, if I use = >> GetCh() in CONIO.H and use printf to print a statement before the = >> GetCh(), it does not show the statement (prompt for input ifyou will) = >> until after the key is pressed. =20 > >Unlike Borland, DJGPP line-buffers stdio. Add fflush(stdout) after the >printf's in the loop (or a \n at the end of the line) and all should work. Not entirely correct... stdout is not line buffered, but fully buffered. And the buffer is 4K in size. So adding a \n will not help. fflush will, though. Also, regarding getch() and printf(), mixing stdio and conio is considered a no-no, and is usually problematic. Either use stdio and use getchar and printf, or use conio with getch and cprintf. > >printf (args...); fflush(stdout); >should update immediately. Correct. > >> Also, how do I stop my EXE file from automatically expanding wild card = >> file masks on the command line? > >There's a CRT-startup-flag thing for that I think. Check the docs or wait >for a followup by someone more knowledgeable than I. (Eli?) Close. What you do is define a function like this: #include char **__crt0_glob_function(char *arg) { return NULL; } > >> And, is there a switch i can use to compile my program to automatically = >> look at LFN rather than having to set LFN=3Dy? > >Well, there must be a mistake or typo here. There is no code in DJGPP that >looks for LFN set to "3Dy". It should be just set LFN=y. I am not aware of >any such switch, nor do I know there isn't one, again check the dox or >wait for followups. I'm pretty sure LFN=y is correct. LFN=3Dy probably came from someone posting in HTML or MIME-text. Nate Eldredge eldredge AT ap DOT net