- Open the source file in read-only mode using the following code:
fp = fopen (argv [1],"r");
- If the file does not exist or does not have enough permissions, an error message will be displayed and the program will terminate, as shown in the following code:
if (fp == NULL) { printf("%s file does not exist\n", argv[1]); exit(1); }
- Open the destination file, the file where the encrypted text will be written, in write-only mode using the following code:
fq = fopen (argv[2], "w");
- Read a line from the file and access each of its characters using the following code:
fgets(buffer, BUFFSIZE, fp);
- Using the following code, subtract a value of 45 from the ASCII value of each of the characters in the line to encrypt that character: ...