home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Shareware Overload
/
ShartewareOverload.cdr
/
progm
/
cpgms.zip
/
UNWS.C
< prev
Wrap
Text File
|
1985-08-05
|
1KB
|
39 lines
/* unws.c: Program to convert a WORDSTAR file to ASCII */
#define ERROR 0
#define CPMEOF 0X1A
main(argc,argv) /* argv is the number of arguements entered
int argc; when the program is executed. argv is
an array of arguements. argv[1], argv[2] */
char *argv[]; /* *argv is the pointer to the pointer to the
string value */
{
int fd, ofd;
char c;
if (argc != 3) { /* check for number of arguements typed */
printf("Enter, unws infile outfile \n");
exit();
}
if ((fd=fopen(argv[1],"r"))==ERROR) { /* check for open input ERROR */
printf("Can't open %s\n",argv[1]);
exit();
}
if ((ofd=fopen(argv[2],"w"))==ERROR) { /* check for open output ERROR */
printf("Can't open %s\n",argv[2]);
exit();
}
while ((c=getc(fd)) != CPMEOF) {
putchar(c);
c=(c & 0x7F);
if (c < 127) {
if (putc(c,ofd) == -1) {
printf("Write error, is your disk full?\n");
exit();
}
}
}
putc(CPMEOF,ofd);
fclose(ofd);
fclose(fd);
}