Mail Archives: djgpp/1997/04/18/08:00:38
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 -