polus
January 3rd, 2006, 11:47 AM
// call function
BYTE *pData;
Func( pData );
// pData no null.
// Function
Func( BYTE *pData )
{
pData = new BYTE[some_data_length];
memcpy( pData, some_data, some_data_length );
}
Why after the function returns is pData nullified?
The pointer is passed in fine, and the memory is allocated OK.
I know its elementary, but I seem to missing something obvious...
Thanks.
BYTE *pData;
Func( pData );
// pData no null.
// Function
Func( BYTE *pData )
{
pData = new BYTE[some_data_length];
memcpy( pData, some_data, some_data_length );
}
Why after the function returns is pData nullified?
The pointer is passed in fine, and the memory is allocated OK.
I know its elementary, but I seem to missing something obvious...
Thanks.