www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2001/01/01/02:21:30

From: Jack Klein <jackklein AT spamcop DOT net>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Bug in djgpp libc
Message-ID: <=SdQOq=CPWe5rcurNWvCGzcde1u0@4ax.com>
References: <92o411$em$1 AT schur DOT institut DOT math DOT jussieu DOT fr> <200012312144 DOT QAA31167 AT envy DOT delorie DOT com> <92ofpp$j9$1 AT schur DOT institut DOT math DOT jussieu DOT fr>
X-Newsreader: Forte Agent 1.6/32.525
MIME-Version: 1.0
Lines: 49
Date: Mon, 01 Jan 2001 06:51:38 GMT
NNTP-Posting-Host: 12.75.158.79
X-Complaints-To: abuse AT worldnet DOT att DOT net
X-Trace: bgtnsc05-news.ops.worldnet.att.net 978331898 12.75.158.79 (Mon, 01 Jan 2001 06:51:38 GMT)
NNTP-Posting-Date: Mon, 01 Jan 2001 06:51:38 GMT
Organization: AT&T Worldnet
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

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 -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019