F
Hallo, noch ein kleiner Nachtrag, die "Speichererweiterungsfunktion" get_more_space() enthielt noch einige Fehler, naja war ja auch von mir..
Also hier die soweit verbesserte und getestete Version - falls sie jemand braucht (das arbeiten mit zweifachen Zeigern ist tueckisch!!!):
int get_more_space(char** str, unsigned long int* str_size, const unsigned long int how_much_more){
char* tmp = NULL;
if((tmp = malloc((*str_size) * sizeof(char))) == NULL) return -1;
if((tmp = realloc(*str, (*str_size + how_much_more))) == NULL){
if(tmp!=NULL) free(tmp);
tmp = NULL;
return -1;
}
*str = tmp;
*str_size += how_much_more;
return 0;
};