hi, sorry for posting this here since this might be a beginner's question:
I need do declare variables with the attribute "binary" - a friend told me i could use this for my problem which is as follows:
I need to create a binary file (which is no problem) and then save variables to that file so that e.g. a double var reserves 4 bytes in that file and fills them with the binary equivalent of its value.
How do i declare variables so that they appear as binary digits when i send them ofstream?
You don't have to declare your variables in a different way. You only have to open the file in binary mode and use the write/read methods instead of the <</>> operators. Take a look here:
hi, that really helped me.
still i have got a problem:
what do i do to send only the values into the binary file?
e.g. when i write a double with value "4" because I want to get (to see in the hex viewer)
00 00 00 00 00 00 00 04
i get instead
00 00 00 00 00 00 10 04
If you want that, you have to store it as an int, not as a double. A double's binary representation may not be exactly what you think. That's why hex editors and cheat engines need you to specify the type (int, double, byte etc...) of the value you want them to search when searching for a specific value.