Mail Archives: djgpp/1997/09/14/14:53:06
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 <crt0.h>
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
- Raw text -