Mail Archives: djgpp/2001/01/01/02:21:30
On 1 Jan 2001 00:34:17 +0100, jmichel AT schur DOT institut DOT math DOT jussieu DOT fr
(Jean Michel) wrote in comp.os.msdos.djgpp:
> In article <200012312144 DOT QAA31167 AT envy DOT delorie DOT com>,
> DJ Delorie <djgpp AT delorie DOT com> wrote:
> >
> >Try this instead:
> >
> >#include <stdio.h>
> >#include <errno.h>
> >main()
> >{
> > errno = 0;
> > printf("\032\n");
> > fprintf(stderr, "%s\n", strerror(errno));
> >}
>
> I get exactly the same output:
>
> No space left on drive (ENOSPC)
>
> Best regards,
> Jean MICHEL
What OS are you running this under? Real MS-DOS, Win9x/ME, or
WinNT/2000?
The C standard requires that stdout be opened in text mode, and 032 is
equivalent to x1a is equivalent to Ctrl-Z which is an end of file
indicator for DOS/Windows text mode files, an old convention inherited
from CP/M. And it is an absolute fact that console mode emulation
under Win9x (and probably ME) has some major "gotcha's" which are not
the compiler's fault.
For example, try entering Ctrl-Z (or the F6 key) to a function
inputting from stdin. Not only does that set an EOF condition on
stdin, but output sent to stdout is discarded up to and including the
first '\n'. In other words, Ctrl-Z on stdin apparently sets EOF on
stdout which doesn't clear until a '\n' (or perhaps fflush(stdout),
haven't tried it).
So the behavior you are seeing might be due to the version of Windows
console emulation you are running under. As for the errno value, do
you have any suggestions for a better one? EOF doesn't make sense for
output streams.
Jack Klein
--
Home: http://jackklein.home.att.net
- Raw text -