Exaactly, I didn't take into account that [] is basically already dereferencing the actual value and hence i "only" need to dereference the list. Is that correct...Oh man, that's confusing ;) ...
Type: Posts; User: cerr
Exaactly, I didn't take into account that [] is basically already dereferencing the actual value and hence i "only" need to dereference the list. Is that correct...Oh man, that's confusing ;) ...
Actually, I have another problem there, let's say that there's more than 1 file in this directory.
Code snippet:
(*filelist) = temp;
printf("DEBUG: filename:%s,...
Nevertheless I changed it to
(*filelist[items]) = malloc(strlen(filename)+1); :)
What's the advantage of using malloc instead of calloc then?
Yes, this actually worked out nicely, thank you! :)
I made a printf("DEBUG: realloc:%dBytes\n",(items+1) * sizeof(*temp)); right after the realloc and it prints: DEBUG: realloc:4Bytes which sounds pretty good to me, no?
Huh but I pass the function...
Well, I have declared char **list=NULL; in my caller function and i do a
temp = realloc(filelist, (items+1) * sizeof(*temp));
if (temp == NULL) {
while (--items >= 0)
...
Hello There,
I wrote a function that reads out all the files in a certain directory and it's writing them into an array of character arrays that was passed. The function looks like this:
int...