Skip to main content
GameDev.net gamedev.net
🔒 Locked

Binary and me

Started by Sponge99 Sep 8, 2000 at 4:45 AM 6 replies 350+ views
Original Post
Sponge99
Sponge99
Whoo, haven''t been here in a while. Been doing a little running. Anyways, I''ve got a question about binary and C/C++. How do I represent it? I did some assembly stuff, and binary was like "0100101b" (note the trailing b) and hex was ''h''. In C, hex is 0x29a for hex, but how do you do binary? Don''t ask why I need this, as I have no particular reason except good ''ol programmers curiosity. Hehe. Also, how do I read binary letters. Like sometimes you people post some letters with little binary messages. Do I convert the binary to decimal and then use it as an ASCII scan code? I did that once, didn''t work out very well......I got something that was all character formating. Anyway, thanks for the help. Quite "General and Game Programming Discussion" indeed. +H3 FU+UR3 ØF MUZ!K MUZ+ NØ+ B37ØNG +Ø +H3 m3D!ØCr3
"Now watch as I run away in a womanly fashion." - Batman
zedzeek
zedzeek
just get a calculator and go 1 decimal and represent that as binary , then try 2 decimal -> binary 3 decimal etc you'll soon work it out.
try the windows calculator

i should mention binary is base 2 bi- hex is base 16 , decimal is base 10

Edited by - zedzeek on September 8, 2000 6:42:52 AM
Sponge99
Sponge99
I know how to read binary (1 = 1, 10=2, 101=5 etc) but I want to know if there is a way to put it in my code. Do I really have to convert it like Mr.ZedZeek said?

Also, I still don''t know about that ASCII-Binary stuff......thanks though!

+H3 FU+UR3 ØF MUZ!K MUZ+ NØ+ B37ØNG +Ø +H3 m3D!ØCr3
"Now watch as I run away in a womanly fashion." - Batman
Ironblayde
Ironblayde
I don''t think there is a notation for it, but it''s trivial to convert binary to hex, so that notation is just as good. After you do this for a little while it will become second nature.

I''m not sure what you mean by ''binary letters'' other than just converting every eight binary digits into an ASCII code. That''s probably what you''re thinking of...

-Ironblayde
 Aeon Software
"Your superior intellect is no match for our puny weapons!"
nano
nano
There is no binary notation in C/C++, I think.
Though, I have seen one or two compilers that
have them.
goir
goir
There is no way to write binary numbers directly in your code in standard c++

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.