I've got the following code:
The thing is that I I'd like to replace a letter, only the asterisk is placed somewhere completely different. Could anyone explain on how to make it work?Code:#include <stdio.h> #include <stdlib.h> FILE * fptr; int main() { char letter; int i; fptr = fopen("C:\\abc.txt", "r+"); printf("Enter: "); scanf("% d", &i); fseek(fptr, (i-1), SEEK_SET); fputc('*', fptr); fseek(fptr, 0, SEEK_SET); printf("The file looks like this: \n"); for (i = 0; i < 26; i++) { letter = fgetc(fptr); printf("The next letter is %c\n",letter); } fclose(fptr); getchar(); getchar(); getchar(); return 0; }
Thanks.



LinkBack URL
About LinkBacks



