First Post, will do my best to follow guidelines and make this a proper setup. If ANYTHING is needed, let me know!
The error in VS 2019 is "C6064: Missing integer argument to 'fscanf' that corresponds to conversion specificer '2'." The code below is given in the part where my code breaks. The rest up to this point is fine and compiles correctly. The line in error is the fscanf.
ENTIRE CODE: https://pastebin.com/DCgEa64g (Excuse any missing variables, they have been dealt with!)
fp = fopen("codefile.txt", "r");
if (fp == NULL)
{
printf("could not open codefile.txt\n");
return 1;
}
i = 0;
while (!feof(fp))
{
fscanf(fp, "%c", &code[i]);
i++;
}
This portion I posted is me scanning a file, codefile.txt, and saving each character inside to a string array, then comparing that array to a "ciphered message" to get an answer. The code compiles the correct answer, but I can't get this error to go away. The other message present is "'fscanf': not enough arguments passed for the format string" but I assumed only %c was needed for a character in a string array?
This also puts each element in codefile.txt into the code array individually, which IS intended. I finished the rest of this assignment, so I'm not asking for somebody to do anything else at all for me. I will gladly post any other code needed! The goal is to read in a separate message file with numbers, put them into an array, descramble and compare to the codefile.txt string and get the result. I did 95% of the work, and need some help! Any clarification, just ask! Turning this in tomorrow evening :)