segfault caused depending on how a function is called
I have this function to trim whitespace which it segfaults
if i call it this way: Code:
/*bad*/ Code:
/*bad*/ Code:
/*works ok*/ Code:
/*works ok*/ thanks a lot in advance. Code:
#define BLOCK_COPY(D,S,L) { if ((L) > 0) memmove ((D),(S),(L)); } |
here is the other function that gets called from the trim function.
Code:
/* int bdelete (char* b, int pos, int len) |
you cant modify a string literal.
|
Quote:
Code:
char * trim (const char *) |
Quote:
ie Code:
int trim(const char* input, char* output); Code:
char buffer[STR_MAX]; |
Hya,
In the old days, --fwritable-stings or something used to take care of this issue. Happy Penguins! |
Quote:
|
All times are GMT -5. The time now is 11:20 PM. |