Almost forgot to post mine.
This is a simple filter type program for text files.
Code:
#include<ctype.h>
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
main(int argc, char *argv[]){
FILE *fd,*out;
int ch,c=0;
if(argc<2){
printf("Usage: Filter <filename><outfile.txt>\n");
exit(1);
}
strcat(argv[1],".txt");
strcat(argv[2],".txt");
if((fd=fopen(argv[1],"r"))==NULL){
printf("Could not open %s\n",argv[1]);
exit(1);
}
if((out=fopen(argv[2],"w"))==NULL){
printf("Could not open\n");
exit(1);
}
while((ch=fgetc(fd))!=EOF){
if(isalpha(ch))
{
if ((toupper(ch) >= 'A') && (toupper(ch) <= 'M'))
ch = ch + 13;
else
ch = ch - 13;
}
fputc(ch,out);
c++;
}
fclose(fd);
fclose(out);
printf("Filter complete with %d bytes read.\n",c);
exit(0);
}