OS/2, eCS & ArcaOS - Technical > Programming
MeShell and PAUSE in a cmd file
Martin Vieregg:
Now I am very close to a solution. Someone answered that I have to use fflush(). But fflush(mystream) is Standard C and requires a stream, not an OS/2 HFILE which is opened via DosOpen(). Is there a comparible call for OS/2 HFILE to flush the buffer ? The editor can detect the problem and the helper calls a flush call for stdout.
Lars:
DosResetBuf.
Why don't you just read the OS/2 programming doc ?
Martin Vieregg:
Yes, I did it, but I tried to find something with "flush".... Thank you.
But anyway, exeuting DosResetBuffer in the helper app has no effect. I also tried to DosClose and DosOpen the named pipe. Also no effect. I really wonder how other command-line frontends do the job.
Martin Vieregg:
I realized now that the "fflush" command has to be placed in the user program. Stdout is always buffered when redirecting, Stderr is not. That is the problem that stderr output can happen before the stdout output. I have got an extreme example, see attachment. I wrote the sample for testing colored output and the stderr output is shown 4 lines before it should be shown.
So that means that all programmers which are writing stdout and stderr or use user queries have to flush stdout before performing a stdin:
--- Code: --- char Expression[200];
printf ("Enter an expression: "); fflush (stdout); scanf ("%s", Expression);
printf ("You have entered: %s\n", Expression);
flush (stdout); fprintf (stderr, "An error has occured.");
--- End code ---
MeShell has been updated to 0.61. See here
Navigation
[0] Message Index
[*] Previous page
Go to full version