Search:

Type: Posts; User: alwut

Search: Search took 0.01 seconds.

  1. Replies
    2
    Views
    1,289

    >rindex returns a pointer, which may be NULL ...

    >rindex returns a pointer, which may be NULL

    >So this makes no sense whatsoever
    >> size = (int)rindex(buffer, '\n') - (int)buffer;

    buffer always has a newline character so i don't have to...
  2. Replies
    2
    Views
    1,289

    Another memory problem

    Ok so occasionally I get a problem and I get a segfault error, and when I check it was with valgrind I get complain how when I strtok in the assignTemps(string, circuit) function, that string is do...
  3. Replies
    10
    Views
    6,330

    The man pages say: Sorry, when I think of...

    The man pages say:



    Sorry, when I think of "error" I think of "fail." But as the man page says, if realloc doesn't do what its supposed to it should return a null pointer right? But instead it...
  4. Replies
    10
    Views
    6,330

    What do you mean? newNode(tokens[i]) returns a...

    What do you mean? newNode(tokens[i]) returns a pointer to a Node and not a Node pointer. I've consulted the forum before and they gave me the "***" solution that I have right now because nodes isn't...
  5. Replies
    10
    Views
    6,330

    The weird thing is when I check 'nodes' in GDB,...

    The weird thing is when I check 'nodes' in GDB, *nodes[0] after it gets realloc'd, it still maintains the original data, but nodes[1] = 0, and GDB doesn't recognize it as a Node* pointer. so if i...
  6. Replies
    10
    Views
    6,330

    Realloc not working

    Hi, I'm having a problem with realloc and I don't know how to fix it. What happens is, I send a null pointer(nodes) to the function createSubckt() which gets malloc/realloc'd depending on conditions....
  7. Replies
    3
    Views
    10,752

    ok i got it, Thanks Salem!

    ok i got it, Thanks Salem!
  8. Replies
    3
    Views
    10,752

    "ls | sort" with pipes and forks?

    I'm practicing with exec and pipes and forks but I can't seem to understand how to have "sort" sort the output of "ls". I'm actually unsure of how to do this. I have my code below.



    #include...
  9. Ok I got it to work now. Thanks a lot. I was just...

    Ok I got it to work now. Thanks a lot. I was just confused and thought there was whole pattern to passing in pointers. ZuK, your example was perfect.
  10. Thank you all for your quick responses, the code...

    Thank you all for your quick responses, the code everyone posted was extremely helpful.

    But i'm getting a weird error, I don't know if its me or something but when I try it with a 2-D pointer it...
  11. I'm having a hard time coming up with the code....

    I'm having a hard time coming up with the code. Could you please give me an example?
  12. Passing a pointer that might not be needed into a function?

    Is there an elegant way to pass a pointer to a function that might not even be needed?

    For example, one way I've been able to do something is:


    void function()
    {
    int* thing =...
  13. Replies
    12
    Views
    1,534

    free() is killing my program?

    So I'm writing a program and for some reason if I leave out the free part it doesn't work in random places so I was wondering if I did something wrong.



    int* list = (int*)malloc(0);
    int num =...
  14. Replies
    3
    Views
    9,107

    I've tried freeing the line after I've finished...

    I've tried freeing the line after I've finished getting and using all the tokens and I get an error because of an invalid pointer at the function call free(). What am i doing wrong?
  15. Replies
    3
    Views
    9,107

    free()-ing after strtok()?

    Hi, i'm writing a program and having some major memory problems(segfault in malloc, malloc_consolidate, SIGABRT in kernel_vsyscall bleh), so I figure it has to do with how I'm freeing memory. So I...
Results 1 to 15 of 15