まず第一に、この標準は必須であり、現在私が使用しなければならないものです。
とにかく、エラーが1つ発生し、FILE *ブロックをメインの内側/外側、実行可能ファイルの前などに移動しようとしました.
#include <stdio.h>
#include <stdlib.h>
/* Initialize vars */
char c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12;
int main()
{
/* Open encrypted.txt for reading */
FILE *enc;
enc = fopen("encrypted.txt", "r");
/* Retrieve individual characters, displace by 4 letters (decryption method) */
c1 = (getc(enc))-4;
c2 = (getc(enc))-4;
c3 = (getc(enc))-4;
c4 = (getc(enc))-4;
c5 = (getc(enc))-4;
c6 = (getc(enc))-4;
c7 = (getc(enc))-4;
c8 = (getc(enc))-4;
c9 = (getc(enc))-4;
c10 = (getc(enc))-4;
c11 = (getc(enc))-4;
c12 = (getc(enc))-4;
/* Display resulting decrypted message */
printf("%c%c%c%c%c%c%c%c%c%c%c%c", (char)c1, (char)c2, (char)c3, (char)c4, (char)c5, (char)c6, (char)c7, (char)c8, (char)c9, (char)c10, (char)c11, (char)c12);
/* Write decrypted message to new file named "decrypted" */
FILE *dec;
dec = fopen("decrypted", "w");
fprintf(dec,"%c%c%c%c%c%c%c%c%c%c%c%c", (char)c1, (char)c2, (char)c3, (char)c4, (char)c5, (char)c6, (char)c7, (char)c8, (char)c9, (char)c10, (char)c11, (char)c12);
/* Close files */
fclose(enc);
fclose(dec);
}
このエラーを取り除く方法についてのヒントをいただければ幸いです。前もって感謝します