Mail Archives: djgpp/1998/03/29/17:05:59
Stardate 8 Mar 98 14:22, Eli Zaretskii log entry:
::
:: On Sat, 7 Mar 1998, Nate Eldredge wrote:
::
:: IMHO, you should avoid setting the console to binary mode at all
:: costs, since this have some nasty side-effects (e.g., you cannot
:: interrupt a runaway program with Ctrl-C). In my experience, it is
:: never really needed anyway: if binary garbage is being sent to the
:: screen, who cares if it gets truncated?
First, thank you for replying to me...
Yeah, I agree, but only in part - I do ACTUALLY want to print the garbage
heading through stdin, but it turns out the way I've been doing it, the
stdin can't be set to O_BINARY anyway 8-(, at least not in this situation:
cat strayfile.binary | hexdump
As you probably have figured out, I need the cat program to open stdin in
O_BINARY, not just hexdump. I am also having problems when using stdin
and then asking for a getch() directly after checking kbhit() - the
program locks up, though getch will work in other situations while using
stdin. I sorted the problem out (temporarily by the following code):
while(!(kbhit())) ; /* Do nothing until key is hit */
if(fi->FPtr!=stdin) getch(); /* Just dump char */
...
Unfortunately this now means that any character I press to exit the help()
gets passed through to my main keyprocessing loop when using stdin - heh,
you should have a look at this monster one day when I've got it
complete...
=-=-
(Later, much later - seems I'd forgotten to mail this baby...)
I found out I could quite happily substitute getxkey for getch - it means it's
not portable, but then I had never intended it to be (at least not until I
port this little so and so to Linux or something...)
Another idea I intend to use this for is to take the output from dd or some
such utility - that way, I could examine the direct output from dd.
I have also thought of something else - it seems what I want to do - using
hexdump on its own without parameters brings up a list of files to choose
from, may get confused unless I explicitly provide a switch to tell
hexdump that stdin is connected to the input, i.e. hexdump -s
Otherwise how is hexdump going to tell the difference between nothing (meaning
read stdin) and nothing (display file list to browse)?
Well, I guess I'd better wrap this letter up and get to send it off...
Cheers for now, The Viking.
---
/| _,.:*^*:., |\ Cheers from the Viking family ...
| |_/' viking@ `\_| | including Marmalade - Running OpenDOS in Christchurch!
| flying-brick | $FunnyMail 5.38 C.S. Lewis: If Man has no God,
\_.caverock.net.nz_/ then where did Man's morals come from?
- Raw text -