Products for USB Sensing and Control
It is currently Fri May 24, 2013 3:34 pm

All times are UTC - 7 hours [ DST ]




Post new topic Reply to topic  [ 3 posts ] 
Author Message
PostPosted: Sat Jun 23, 2012 6:22 pm 
Offline
Fresh meat

Joined: Sat Jun 23, 2012 6:16 pm
Posts: 2
I'm working with the example for phidgets bridge, and I'm well confused on how to use the input argument void *userPtr for the function that goes in Phidget_set_OnAttach_Handler.

I'm assuming that it's a way for me to pass in a pointer to get the data out of the function, but all the example code has this set as 'NULL'. How does one actually make use of that argument?


Top
 Profile Send private message  
 
PostPosted: Sun Jun 24, 2012 5:38 am 
Offline
Phidgetly

Joined: Thu Mar 04, 2010 2:51 am
Posts: 39
It could be anything (a value, a pointer, whatever), just make sure to cast it to whatever you sent in. I use it to call functions in C++ objects. Have a look at my recently posted http://phidgets.com/phorum/viewtopic.php?f=42&t=5598, and see line 38 and 43 of RFID-phidgets.cpp


Top
 Profile Send private message  
 
PostPosted: Sun Jun 24, 2012 9:03 am 
Offline
Fresh meat

Joined: Sat Jun 23, 2012 6:16 pm
Posts: 2
thanks! That makes so much more sense now. I'm still fairly new to c++, so the pointer/class notation probably messed my understanding. Always good to see an example of use :)


Top
 Profile Send private message  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC - 7 hours [ DST ]


Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  
Powered by phpBB® Forum Software © phpBB Group