delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp-workers/1998/03/22/08:25:54

Date: Sun, 22 Mar 1998 16:24:36 +0300 (IDT)
From: Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>
To: DJ Delorie <dj AT delorie DOT com>
cc: djgpp-workers AT delorie DOT com
Subject: Re: ^Z in text-mode output to the screen
In-Reply-To: <199803151812.NAA18163@delorie.com>
Message-ID: <Pine.SUN.3.91.980322162408.12221U-100000@is>
MIME-Version: 1.0

On Sun, 15 Mar 1998, DJ Delorie wrote:

> > 	C:\DJGPP\BIN> grep foobar *
> > 	grep: writing output: No space left on device (ENOSPC)
> > 
> > This happens if one of the files has the ^Z character embedded in it.
> 
> Can we put stdout in raw mode without putting stdin in raw mode?
 
It seems we can't.  The small test program below says that when
stdout is put into raw mode, stdin is reported to be in raw mode as
well.

That's what I would expect, since both these handles refer to the same
device.

But even if we could do that, how would this help solving the problem
at hand?

--------------------------------------------------------------------
#include <stdio.h>
#include <fcntl.h>
#include <io.h>
#include <dpmi.h>
#include <go32.h>

int main (void)
{
  __dpmi_regs r;

  setmode (fileno (stdout), O_BINARY);

  r.x.ax = 0x4400;	/* IOCTL Get Device Info */
  r.x.bx = fileno (stdin);
  __dpmi_int (0x21, &r);
  if (r.x.flags & 1)
    {
      printf ("214400\t Failed...\n");
      return r.x.ax;
    }
  else
    {
      printf ("214400\t Succeeded; STDIN is in %s mode\n",
	      (r.x.dx & 0x0020) ? "RAW" : "COOKED");
      return 0;
    }
}

  

- Raw text -


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