OK here's the actual code, I did simplify it a bit initially, but I think this may help if I paste the code proper. (There's a few things I've tried and failed that are commented out)
#define...
Type: Posts; User: Mitch
OK here's the actual code, I did simplify it a bit initially, but I think this may help if I paste the code proper. (There's a few things I've tried and failed that are commented out)
#define...
hence my asking here ;)
i just cant figure it out.
I've just replaced the
chunk.memory=&chunk.memory[1];
line with a new one using memmove, still got it.
EDIT:
I read something somewhere...
but then that defeats the whole point of using strncpy: to remove the last 773 chars from the string.
EDIT:
I just tried commenting out that whole section of code and it made no difference - I...
I've just tried assigning and writing tempstr1 with malloc() and the appropriate size and i still get the error.
it's 448 chars. if it was overflowing, why would printf still print all the data upto the end?
+ that's not the point where i get the segfault. the error occurs after all that code and i try to...
chunk.memory is allocated as in my previous post and tmpstr1 is declared as
char tmpstr1[2048];
the sample data I'm using is only a few hundred chars.
The data is created with these functions:
void *myrealloc(void *ptr, size_t size)
{
// There might be a realloc() out there that doesn't like reallocing NULL pointers, so we take care of it...
I've been pouring over this for over a day now and still have no solution, so hopefully I'll get one here :D
I have a struct
struct MemoryStruct {
char *memory;
size_t size;
}; which...