Search:

Type: Posts; User: NotAProgrammer

Search: Search took 0.01 seconds.

  1. Hi c99tutorial, As far as I can tell, when I...

    Hi c99tutorial,
    As far as I can tell, when I type:


    FILE* fp = fopen("C:/Project/My Folder/output.csv", "w");
    fprintf(fp, "Hello. This is foo.csv.\n");
    fclose(fp);

    It writes the...
  2. Hi Algorism, The exact output is [C:/Project/My...

    Hi Algorism,
    The exact output is [C:/Project/My Folder/output.csv] so it looks like there are no weird formatting characters with the spaces. How do I get C to recognize the string as a file path...
  3. Hi Salem, The literal string works absolutely...

    Hi Salem,
    The literal string works absolutely fine and it look like the entire string is passing through the function. That's why I thought trying to paste quotes around it might work, but there...
  4. Problems passing file path names with spaces into function

    Hi all,
    I am writing a C function that can be called through R and am running into problems with passing file path name strings that contain spaces. I know it is bad practice to have spaces in path...
  5. I think I just solved my own problem. I shouldn't...

    I think I just solved my own problem. I shouldn't have malloc'ed memory to the array pointers when initializing the array because I then lose that memory when I allocate a new head node to the list. ...
  6. Freeing memory from dynamically allocated array of linked lists

    Hi folks,
    Having some frustrating issues trying to free memory from a dynamically allocated array of pointers to linked lists. I think the problem is in how I initialize the pointers to NULL. Is...
  7. Replies
    10
    Views
    3,779

    I gave up trying to get realloc to work in the...

    I gave up trying to get realloc to work in the for loop without leaking memory and instead re-wrote the code using linked lists to temporarily store the new array elements. At the end of the for...
  8. Replies
    10
    Views
    3,779

    This is a much simplified version of the way the...

    This is a much simplified version of the way the function is currently called in the program, but compilable.

    I am a little bit confused by:
    "There is also a memory leak as, when reallocating...
  9. Replies
    10
    Views
    3,779

    Error using realloc inside function

    Happy holidays C gurus! I am running into a strange error using realloc to resize a 2D array within a function and could use some advice.

    The function is designed to remove duplicate entries...
  10. Thanks! - initializing the anim_list array values...

    Thanks! - initializing the anim_list array values to NULL did the trick and I definitely would not have spotted that without your help so much appreciated.

    I can't remember why I originally set up...
  11. Help with seg fault error initializing an array of structs inside a struct

    Hi guys,
    I am trying to create an array of structs and then initialize values in the array of structs contained within each node. I keep getting a segmentation fault error when the program tries to...
  12. Problem transferring nodes between linked lists

    Hi C wizards,
    I am working on a demographic simulation model where I have a population of individual people represented as structs:



    struct person
    {
    int age;
    struct person *next_node;...
  13. That absolutely did the trick and thank you for...

    That absolutely did the trick and thank you for the great explanation. I am posting the final code in case some other wayward soul with qsort problems stumbles across this thread.



    #include...
  14. Worked like a charm once I changed the qsort...

    Worked like a charm once I changed the qsort call. Thank you so much for taking the time to look at my code! Now to plug it back into the rest of the program.
  15. Thanks. I did try using various print statements...

    Thanks. I did try using various print statements and breakpoints to chase down the error before posting here. The array appears to initialize, but qsort passes a NULL pointer to argument 2 of the...
  16. Help - error sorting dynamically allocated 2D integer array

    Hi,
    First time posting on this forum and I have an embarrassingly newbie question about using qsort with dynamically allocated 2D arrays.

    I need to sort a large dynamically allocated 2D integer...
Results 1 to 16 of 16