Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations MikeeOK on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Binary junk

Status
Not open for further replies.

XerxesTheMighty

Programmer
Jun 15, 2003
72
US
How would I create a variable with a binary value or Hex value? For instance, '00 00 00 00', has no ascii equivalent.
 
An easy way is to allocate an automatic variable and 'forgetting' to initialize it. It can contain anything.
This is a typical error.

If you want to be creative, fill the variable with 'binary junk' (I like that expression).

{
char junk[32]; // Don't know what's in it

junk[0] = 0x01;
junk[1] = 0x05;
etc.... you are in charge .....
}

/JOlesen
 
That won't help me much with what I'm doing. That's ingenious though. See, I'm making a REG_BINARY key. The problem is that it's inputing characters and not binary data (so therefore screws the registry key up).

PS: And if you liked my 'binary junk', you should see the programs I write.
 
>> The problem is that it's inputing characters and not binary data (so therefore screws the registry key up).

No, that is not a problem. Characters are nothing but mappings in a certain character set, in otherwords, 8-bit binary values.

Besides, the buffer is typecasted to the LPVOID type anyway.

I REALLY hope that helps.
Will
 
Found the solution (this will work with REG_BINARY or REG_DWORD)::

RECT j = {0,0,0,0};//fill this with data

RegSetValueEx(key, "Name of key", 0, REG_BINARY,(CONST BYTE*)&j.left, sizeof(j.left));
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top