Re: creating a testfile for catv





"Richard Heathfield" <rjh@xxxxxxxxxxxxxxx> wrote in message
news:0IadnYzH_uOWvG3anZ2dnUVZ8h-dnZ2d@xxxxxxxxx
C. Gordon Liddy said:

<snip>

Current output with catv is:
the quick brown fox^J^@^A^B^C^D^E^F^G^H^I^J^K^L^M^N^O^P^Q^R^S^T^U^V^W^X^Y

So after it reads and writes the control characters, it doesn't want to
print anything more.

It is very suggestive that your output stops at Ctrl-Z, which is used as
an
end-of-text-file marker by some systems. The fix is obvious - open the
file in binary mode:

<snip>

#include <stdio.h>

int main(int argc, char **argv)
{

FILE *fp;
void filecopy(FILE *, FILE *);

if (argc < 2) printf("die");
else
while (--argc > 0)
if ((fp = fopen(*++argv, "r")) == NULL)

Change "r" to "rb" and re-test.
Thanks, Richard. My output is coming around.

the quick brown
fox^M^J^@^A^B^C^D^E^F^G^H^I^M^J^K^L^M^N^O^P^Q^R^S^T^U^V^W^X^Y^#^[^\^]^^^_
!"#$%&'(jumps
over^M^Jdefghijklmnopqrstuvwxyz{|}~^?MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMthe
lazy dog^M^J

Sometimes hitting the send button on a post is the exact stimulus one needs
to realize what's in his blind spot: ctrl-z is eof for windows. rb instead
of r works. I tried to do the same thing for that the original did for del:
if (ch == '\177')
{
/* ch is DEL, we want "^?" */
ch2 = '?';
}
else if(ch == 26)
{
/* we don't want ctrl-z coming out of here */
ch2 = '#';
}
I'm puzzled that this didn't work.

I've got some behavior for non-ascii characters. Again, I'll try to emulate
what came off the bsd site:
if (!isascii(ch)) {
if (putchar('M') == EOF || putchar('-') == EOF)
break;
ch = toascii(ch);
}

Heck, I can just paste it in wholesale. Woo-hoo.

--



.