delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/04/18/08:00:38

Sender: brozzis AT mag00 DOT cedi DOT unipr DOT it
Message-Id: <33575C14.33CE@mag00.cedi.unipr.it>
Date: Fri, 18 Apr 1997 13:33:40 +0200
From: Stefano Brozzi <brozzis AT mag00 DOT cedi DOT unipr DOT it>
Mime-Version: 1.0
To: djgpp AT delorie DOT com
Subject: Was: JPEG. <STDIN> Probs

Ok, I've upgraded grep, and now it works correctly and get all Ctrl-Z.
But my programs still freeze up expecting something at STDIN.
BCC works fine with Ctrl-C, Ctrl-Z.
Debugging with RHIDE it locks at fread() (quite obviously :)
As always stated I've created the shortest amount of code that
reproduces the odd behaviour.
I'm running the latest DJGPP, on a Win95 DosBox.

In info page of setmode() there's no hint about where O_BINARY is
defined.
It is in fcntl.h not in io.h where setmode() is declared, shouldn't be
adviced the poor programmer ? ;)
I've the K&R at a couple of meters from here, should I move it closer ?

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

#define SIZE  100    /* my try */


{
   FILE *f;
   int FileHandle = 0;
   char Buf[10];

    setmode(FileHandle, O_BINARY);
    f = fdopen(FileHandle, "rb");
    setvbuf(f, NULL, _IOFBF, SIZE);

    if (fread(Buf, 1, 9, f) != 9) {       /* do something */    }

    fclose(f);

}
---------------------


        TIA
        Stefano

- Raw text -


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