STRING* parameter

Posted By: Ch40zzC0d3r

STRING* parameter - 08/10/13 11:07

Hey guys!
Ive got a big problem here frown
So Im using this code (pseuode function):
Code:
function writeString(STRING *strParam)
{
	wait(-1);
	strParam = str_create("test");
}

...

STRING *szRet;
writeString(szRet);
while(szRet == NULL) wait(1);
printf("%s", _chr(szRet));



But the while wont ever break!
I need this for receiving special infos from a sql database...
Posted By: Aku_Aku

Re: STRING* parameter - 08/10/13 12:28

Try this.
Instead of strParam = str_create("test"); use strParam = str_create("");
And insert this line:
str_cpy(strParam,"test");
Posted By: Ch40zzC0d3r

Re: STRING* parameter - 08/10/13 12:40

Nope, sorry doesnt work.
I think the parameter pointer gets fucked up anyhow...
If I printf("%X, &strParam) the address before and after the wait is different frown
Posted By: MasterQ32

Re: STRING* parameter - 08/10/13 13:46

Code:
function writeString(STRING *strParam)
{
	wait(-1);
	str_cpy(strParam, "hey this works!");
}

...

STRING *szRet = str_create("#256");
str_cpy(szRet, ""); //Set to length 0
writeString(szRet);
while(str_len(szRet) == 0) wait(1);
error(szRet);

Posted By: Ch40zzC0d3r

Re: STRING* parameter - 08/10/13 16:11

Thanks youre the best wink
Works perfectly!
© 2024 lite-C Forums