Create a buffer of the file. Compress the buffer. Delete the file (remove). Write the buffer to a file.
FILE:"This is an Example."
Code:
#include <stdio.h>
#include <stdlib.h> // for malloc/free
#include "yourfunctions.h"
int main(void)
{
char *mybigbuffer;
mybigbuffer = malloc(BIGBUFFERSIZE); // defined in yourfunctions.h
if (mybigbuffer == NULL){
crapout();
return -1;
}
doreadme("FILE", mybigbuffer);
remove("FILE"); // BTW, this is redundant.
doremovetext(mybigbuffer, "is an Ex");
dowriteme("FILE", mybigbuffer);
free(mybigbuffer);
return 0;
}
FILE:"This ample."