Could you guys look at the following code?
Code:
#include <stdio.h>
#include <stdlib.h>
int main() {
FILE *f;
char c=0, temp[512]={0};
int br=0;
if ((f=fopen("fajl.htm", "r+"))==NULL) {;
exit(1);
}
while ((c=fgetc(f))!=EOF) {
if (c=='&') {
fseek(f, 0, SEEK_CUR);
printf("%d", fputc('q', f));
}
}
fclose(f);
return 0;
}
I'm trying to add 'q' after each ampersand (replacing the character that is already there). However, after running this program on a file that has "&AAAAA", I get the following output:
Code:
&qAAAAA
様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様
Any idea what's wrong?