cwilson@NISC.SRI.COM (Chan Wilson) (09/07/90)
Due to the fact I haven't gotten around to creating comp.sources.apple2,
this appears on comp.binaries.apple2. It's a quick little C hack
to strip the 8th bit off a file. Should run on any unix box,
compile with 'cc -o strip8 strip8.c' type idea.
tested on sun systems..
oh, prints to stdout...
---------->snip<---------------------->snip<---------------------->snip<------------
#include <stdio.h> /* standard io */
main (argc,argv)
int argc;
char *argv[];
{
int a;
char prog[10];
FILE *fpointer;
if (argc>1) /* check for filename arg */
{
strcpy(prog,argv[0]);
if (!(fpointer=fopen(argv[1],"r"))) /* check for existence */
{
perror(prog);
exit(1);
}
printf("%s:",argv[1]);
}
else fpointer=stdin; /* no filename, use stdin */
do
{
if((a=fgetc(fpointer))==EOF) break; /* exit if eof */
a &= 0x7f;
if (a==13) printf("\n");
else printf("%c",a);
} while (!feof(fpointer)); /* do until all done */
printf("\n");
fclose(fpointer);
}
---------->snip<---------------------->snip<---------------------->snip<------------