Newbiee here, I am trying to scan characters from a txt file and output it to another txt file. I think my problem is conversion specifiers converting int to char so my result is weird characters. Thanks for your help.
#include <stdio.h>
#define NROW 676
#define FILEIN "lettercombo.txt"
#define FILEOUT "lettercomboout.txt"
int main(void) {
//Variables
int i;
char combo [NROW];
FILE *lcombo;
FILE *lcomboout;
//Writes output file or overwrites previous one
lcomboout = fopen(FILEOUT,"w");
// Open file and read data into array
lcombo = fopen(FILEIN,"r");
for (i=0; i<677; i++)
fscanf(lcombo,"%c",&combo[i]);
for (i=0; i<677; i++)
fprintf(lcomboout,"%c \n",combo[i]);
return 0;
}
Update post: I forgot to add the input file in the same folder. I appreciate the help, it works :)