View Single Post
  #1   (View Single Post)  
Old 23rd October 2009
robbak's Avatar
robbak robbak is offline
Real Name: Robert Backhaus
VPN Cryptographer
 
Join Date: May 2008
Location: North Queensland, Australia
Posts: 366
Default c++: writing to the *this pointer?

For context, I have a bitmapped field coming from a snmp reply that I can get from a printer. (panasonic workio DP-C264 - if anyone has technical documentation on it, I'd be glad to know!) I can information out of it with this line-
Code:
    vb.get_value( (unsigned char *)&Job, Job_len, sizeof(snmpjoblog ));
where Job is an instance of a class containing the what ints and char arrays I have detected: there are a lot of char[n] unknowns and int unknowns.
I'd like to roll the function to extract that info into the class, which would mean this:
Code:
    vb.get_value( (unsigned char *)this, Job_len, sizeof(snmpjoblog ));
As in, writing binary data over the top of the class itself. Now, when it compiled without error, I was suprised. But will this really work?
(I'm going to go try it with a utility I wrote, but I'd still like your input!)
__________________
The only dumb question is a question not asked.
The only dumb answer is an answer not given.
Reply With Quote