Search:

Type: Posts; User: dwks

Search: Search took 0.04 seconds.

  1. Replies
    14
    Views
    10,841

    (*filelist[items]) = malloc(strlen(filename)+1);...

    (*filelist[items]) = malloc(strlen(filename)+1);

    Instead of that you probably want

    (*filelist)[items] = malloc(strlen(filename)+1);

    assuming that filelist is a char*** as bithub and itCbitC...
  2. Replies
    14
    Views
    10,841

    I guess I wasn't clear: if you use calloc(), you...

    I guess I wasn't clear: if you use calloc(), you zero the memory and then overwrite it. If you use malloc(), you never spend time zeroing memory which is just going to be overwritten anyway.

    Of...
  3. Replies
    14
    Views
    10,841

    For what it's worth, calloc() zeros out the...

    For what it's worth, calloc() zeros out the memory it allocates, but you go and overwrite the data with a strcpy() immediately afterwards -- so I'd be inclined to use malloc() instead of calloc() to...
Results 1 to 3 of 3