Inversion

Dave Kraft davek at lakesys.UUCP
Wed May 3 11:42:53 AEST 1989



Hi,
Aftter a few hours of research, I solved my own problem.  I have alos posted
the finished product, wich works quite well.  If you have any questions, please
send them in email.  Thanks.

/* crypt.c --Encrypts/decrypts files.  Works both on Unix/Xenix and 
 *         Turbo C 2.0.
 * Direct mail enquiries to:  davek at lakesys.lakesys.com -OR-
 *                            uunet!marque!lakesys!davek
 */

#include <stdio.h>

main()
{
	char fn1[30],fn2[30],c;
	int i;
	FILE *f1,*f2,*fopen();

	scanf("%s%s",fn1,fn2);
	f1 = fopen(fn1,"r");
	if(f1 == NULL){
		printf("Error opening %s.\n",fn1);
		exit(1);
	}
	f2 = fopen(fn2,"w");
	if(f2 == NULL){
		printf("Error opening %s.\n",fn2);
		exit(2);
	}
	while(feof(f1) == 0){
		c = fgetc(f1);
		fputc(~c,f2);
	}
	fclose(f1);
	fclose(f2);
}

I know I could've used argc and argv, but, this was quicker.
-- 
davek at lakesys.lakesys.com -OR- uunet!marque!lakesys!davek
-------------------------------------------------------------------------------
"The mystical divinity of unashamed felinity.  'Round the cathedral rang
'Vivat!'  Life to the everlasting Cat!" --'Cats'



More information about the Comp.lang.c mailing list