Re: pointer argument trouble
voidtwerp wrote:
Am I being really stupid here - I cant see what the problem is.
how can I be getting different values in coincount[i] and count? (note
that I dont think either is correct but I cannot be sure at this
stage).
// 3rd party dll header file
extern "C" {
APIDLL_EXPORT bool _cdecl ENGINE_GetCoinCount(uint CoinValue,ulong*
cnt);
And what is the implemenatation of that function? Next time post it
because it might be relevant...
BTW, I can _guess_ what 'ulong' and 'uint' are, but you need to tell
us what it is. And, 'APIDLL_EXPORT' or '_cdecl' are also undefined
here.
}
// my .cpp file
void Help_ProductSale_CountCoins(uint coinvalue[],ulong coincount[])
{
ulong count;
for(int i=6;i--;)
{
ENGINE_GetCoinCount(coinvalue[i],&coincount[i]);
ENGINE_GetCoinCount(coinvalue[i],&count);
printf("Count %d: %d (%d)\r\n",i,coincount[i],count);
If you want to print 'unsigned long' values, you need to add 'l' to the
format specification, IIRC.
}
}
bool Test_ProductSale()
{
uint coinvalue[]={5,10,20,50,100,200};
ulong coinstart[6];
Help_ProductSale_CountCoins(coinvalue,coinstart);
}
output:
Count 5: 0 (0)
Count 4: 0 (0)
Count 3: 0 (0)
Count 2: 235138746 (0)
Count 1: 5 (0)
Count 0: 60597997 (0)
V
--
Please remove capital 'A's when replying by e-mail
I do not respond to top-posted replies, please don't ask