con realloc verrebbe una cosa del genere credo:

FILE* fp;
char* testo,*temp;
int i=0;

fp=fopen("pippo.txt","r");
testo=(char*) malloc(sizeof(char));

while(fscanf(fp,"%c",&temp)!=EOF) {
testo=(char*) realloc(testo,(i+1)*sizeof(char));
*(testo+i)=temp;
i++;
}

testo[i]='\0';