Im doing a project to change the letter 'e' to 'a' and I still didnt have it right at all. My input is a file abc.txt: '''
Im enne end
my ded is frenk
My mom is elycie Lou
''' and my output is "My mom is alycie Lou" and in another line "My mom is alicya Lou". Heres my code. Can anyone helps me?
'''
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define MAX_LINE 3
#define MAX_STRING_SIZE 50
int main()
{
char line[MAX_LINE][MAX_STRING_SIZE];
int i=0;
FILE *arch;
arch = fopen("abc.txt", "r");
if (arch==NULL){
printf("ERROR");
}
else{
while (!feof(arch)){
fgets(line[i], MAX_STRING_SIZE , arch);
i++;
}
}
fclose(arch);
for ( i=0; line[i][MAX_STRING_SIZE]; ++i )
{
if ( line[i][MAX_STRING_SIZE] == 'e' )
{
line[i][MAX_STRING_SIZE] = 'a';
}
}printf("%s", line);
return 0;
}
'''