www.digitalmars.com         C & C++   DMDScript  

c++ - const void*

reply "Shyam Iyengar" <shyam encodexindia.com> writes:
Guys,

I have a buffer buf. It's defined as const void* buf (In the param of a
function).

BOOL Write(const void* buf, ULONG nBytes, ULONG* pBytesWritten = NULL)
{

}

How can I access this variable data.

Is it by capturing it in const char* or something else.

Shyam
May 15 2003
parent Jan Knepper <jan smartsoft.us> writes:
Depends on whether you are coding C or C++


 BOOL Write(const void* buf, ULONG nBytes, ULONG* pBytesWritten = NULL)
 {
const char *ptr = ( const char * ) buf; // Should work for C and C++ const char *ptr = static_cast < const char * > ( buf ); // Should work for C++
 }

 How can I access this variable data.

 Is it by capturing it in const char* or something else.
-- ManiaC++ Jan Knepper
May 15 2003