¿I can delete specific characters of a text file? for example, i have a file text with "123456". I'd like delete the number '3' only. ¿what function can i use?
#include <windows.h> #include <stdio.h> int main(int argc, char **argv) { FILE *f; char *buffer; size_t size; f = fopen("temp.txt","rb"); if (f) { fseek(f, -1, SEEK_END); size = ftell(f); fseek(f, 0, SEEK_SET); buffer = malloc(size); fread(buffer, size, 1, f); fclose(f); f = fopen("temp.txt","wb"); if (f) { fwrite(buffer, size, 1, f); fclose(f); } free(buffer); } // Other architectures might permit // fseek(f, -1, SEEK_END); // fwrite((void *)f, 0, 0, f); // fseek(f, -1, SEEK_END); // ftruncate(f); return(1); }
thanks, you're very kind for your help.