comparing two void* values
-
hi every1 im writing a code that needs to compare two poitner of type (void *) i dont know how to do that; i tries to use the memcmp function but it requires a length parameter ! thanks already
-
hi every1 im writing a code that needs to compare two poitner of type (void *) i dont know how to do that; i tries to use the memcmp function but it requires a length parameter ! thanks already
-
hi every1 im writing a code that needs to compare two poitner of type (void *) i dont know how to do that; i tries to use the memcmp function but it requires a length parameter ! thanks already
If you need to compare the pointer values, just compare them using normal operators. If you need to compare the things that the pointers point to you need more information about them:
int iValueA = 1;
int iValueB = 1;void *vp1 = &iValueA;
void *vp2 = &iValueB;
void *vp3 = &iValueA;if( vp1 == vp3 )
{
OutputDebugString( _T( "vp1 == vp3\n" ) );
}
if( vp1 == vp2 )
{
OutputDebugString( _T( "vp1 == vp2\n" ) );
}
if( *(int*)vp1 == *(int*)vp2 )
{
OutputDebugString( _T( "*vp1 == *vp2\n" ) );
}Peace! [edit] Alright - who is the buttmonkey that voted this a 2 with no reason given? ;P [/edit] -=- James
If you think it costs a lot to do it right, just wait until you find out how much it costs to do it wrong!
Avoid driving a vehicle taller than you and remember that Professional Driver on Closed Course does not mean your Dumb Ass on a Public Road!
DeleteFXPFiles & CheckFavorites (Please rate this post!)