>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...
Type: Posts; User: alwut
>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...
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...
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...
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...
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...
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....
ok i got it, Thanks Salem!
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...
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.
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...
I'm having a hard time coming up with the code. Could you please give me an example?
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 =...
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 =...
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?
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...