Results 1 to 4 of 4
Hello all,
I have the following :
main ()
{
int returncode ;
[snip]
retval = TransHist_Create( merchant_id, &trans_hist_id, transact_id, from_step_id, num_proc, num_succ, num_fail, num_user_err, todays_date, proc_user_id, addendum, getlocalhost(), getpid(), ...
- 02-18-2011 #1Just Joined!
- Join Date
- Jun 2009
- Posts
- 33
Function call good :) ReturnCode Bad :(
Hello all,
I have the following :
main ()
{
int returncode;
[snip]
retval = TransHist_Create( merchant_id, &trans_hist_id, transact_id, from_step_id, num_proc, num_succ, num_fail, num_user_err, todays_date, proc_user_id, addendum, getlocalhost(), getpid(), 0, __FILE__, __LINE__, &returncode);
}
Now, in the function : TransHist_Create(...., *returncode)
{
....... [snip] ...
*returncode = 0;
return 0;
}
BUT ..
in main, the returncode is set to --> 1 <-- ?!?!
Why??
TIA
- 02-18-2011 #2Just Joined!
- Join Date
- Jun 2009
- Posts
- 33
Hello again,
I read this here:
Call by Value and Call by Reference
But i guess i am still missing something ..
Can someone please tell me how to pass a value to a function in such a way that a function can change it?
-> I want to pass in a value called: returncode
-> Have the function change it
-> and then review it from the calling program.
How can this be done?
TIA
- 02-18-2011 #3Just Joined!
- Join Date
- Jun 2009
- Posts
- 33
PS - the reason why I am not doing it as :
return_code = Function()
is because I have been burned on this. The return code in the function is 0 but the value returned is <> 0.
So, I was trying something else ...
- 02-27-2011 #4Linux Guru
- Join Date
- Apr 2009
- Location
- I can be found either 40 miles west of Chicago, or in a galaxy far, far away.
- Posts
- 8,974
You only posted a snippet of your function call arguments and the actual signature of the function itself. Please post in detail. As someone once said, there be the Devil (in the details)...
Sometimes, real fast is almost as good as real time.
Just remember, Semper Gumbi - always be flexible!


Reply With Quote