home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
ftp.wwiv.com
/
ftp.wwiv.com.zip
/
ftp.wwiv.com
/
pub
/
UTILITY
/
SWC.ZIP
/
SWC.C
Wrap
Text File
|
1994-01-16
|
1KB
|
56 lines
Diamond #196 @3950
Sat Jan 15 21:15:33 1994
0R: net33: @3113 (via @1021) [23:03 01/16/94]
0R: net34: @1021 (via @1040) [20:21 01/16/94]
0R: net33: @1040 (via @2050) [12:14 01/16/94]
0R: net34: @2050 [10:25 01/16/94]
0R: net34: @2050 (via @1040) [02:47 01/16/94]
0R: net33: @1040 (via @1021) [03:08 01/16/94]
0R: net34: @1021 (via @3950) [23:39 01/15/94]
0R: net34: @3950 [21:47 01/15/94]
RE: ASCII strip program
BY: Nirvana #1 @6655
/*
* SWC.C
* This program will strip WWIV color codes (heart codes) from a file.
*
* Source code written by Diamond #1 @3956
* Please give credit where credit is due.
*/
#include <stdio.h>
#include <fcntl.h>
#include <share.h>
#include <sys\stat.h>
void main(int argc,char **argv)
{
int input,output,i;
unsigned char ch;
if(argc<2) {
printf("Must specify filename.\n");
exit(1);
}
input=open(argv[1],O_RDONLY|O_BINARY);
if(input==NULL) {
printf("Bad filename \"%s\"",argv[1]);
exit(1);
}
output=open("TEMP.XXX",O_CREAT|O_TRUNC|O_RDWR|O_CREAT,S_IREAD|S_IWRITE);
i=_read(input,&ch,1);
while(i>0) {
if(ch!=3)
_write(output,&ch,1);
else
_read(input,&ch,1);
i=_read(input,&ch,1);
}
close(input);
close(output);
unlink(argv[1]);
rename("TEMP.XXX",argv[1]);
}