RW> Your opinion is that getStream(1) as defined in stdio.h
RW> cannot be used to capture those ANSI escape sequences so
RW> that I can print out with cprintf. I have cprintf here
RW> in its C function form so that I could change it around
RW> (re-compile it and put it back into my lib).
cprintf() and stdout have nothing to do with eachother,
usually. __getStream(1) assigns a file pointer to stdout.
The Borland default implementation of cprintf() is a direct
video memory access data manipulation. I believe, however,
that you may specify that it be otherwise. I will check...
[ dig .. dig .. shuffle .. rumble .. RUMBLE?! Landslide! ]
( scrambling out, standing up, brushing self off )
Ah... found it. Try putting
directvideo = 0;
in your code. That may be what you are seeking. Otherwise,
if it is your intention to limit the output window on the
stdout display, then that IS possible, though I don't know
the means whereby it is done. There were examples of this
posted in the past, but I don't seem to have any of them
in my personal archives. It would not conform to your
window() parameters unless you specifically informed it of
those parameters, however. Changing the value of directvideo
to 0 may cause an automatic interpretation of data to keep
it all in a defined area, or maybe they even tweek the
output parameters via some interrupt call for you.
Hmm... I should just test it, shouldn't I?
[ fumble .. fumble .. mix .. mix .. shake .. shake .. AhaH! ]
Ok. It didn't work. This is what I tried. It didn't intercept
the escape sequences at all. Perhaps I should have opened it
in binary, but I don't think it would make much difference,
as far as interpretation of escape sequences is concerned.
I think intercepting and interpreting the color and cursor
changes before sending the output to cprintf() is the way.
#include
#include
int main(int argc, char **argv)
{
FILE *Read_in;
char buf[512];
if(argc < 2)
{
puts("usage: wndotest filename.ext");
return 1;
}
Read_in = fopen(argv[1], "r");
if(!Read_in)
{
printf("Unable to open %s.\n", argv[1]);
return 2;
}
window(1, 1, 80, 25);
directvideo = 0;
clrscr();
while(fgets(buf, 512, Read_in));
cprintf(buf);
fclose(Read_in);
getch();
return 0;
}
> ] Optimist: Says I'm not all bad when I'm not much good.......
---
---------------
* Origin: *YOPS ]I[* 8.4 GIG * RA/FD/FE * Milwaukee, WI (1:154/750)
|