|
From: Michael G. <mg...@te...> - 2005-05-17 01:55:02
|
Hi Liam ! You have a misconception about passing pointers to subroutines. You have 'int getDataToken(char* data, char* dataToken, int tokenNbr)' which means getDataToken gets a _local_copy_ of dataToken (which initially points to the same memory as the copy in the invoking code. Later in your function you change the value of the copy by calling realloc. Now you have changed the copy but not the original. In fact you also invalidated the memory the original does point to. To achieve what you are after you'll have to pass a _pointer_ to the pointer you wish to change: int getDataToken(char* data, char** dataToken, int tokenNbr) which is invoked by=20 =C2=A0 =C2=A0 err =3D getDataToken(HTTPData, &dataToken, 0); Inside of getDataToken you have to replace all dataToken by (*dataToken). Doing that will yield the desired result (i.e. not regarding possible other programming error ;-) HTH, best, Michael =2D-=20 Vote against SPAM - see http://www.politik-digital.de/spam/ Michael Gerdau email: mg...@te... GPG-keys available on request or at public keyserver |