Built in Conversion from Integer to Binary String?
Hello all,
Newish to C and just wanted to ask a variation on a common question on this board and google. I have a variable that I'm reading that runs anywhere between 0-128, with each bit of that binary representation meaning a different thing. (1, 2, 4,...64, 128 each mean a different thing when returned) Well problem is now we're allowing multiple values inside there which breaks us out of those 8 responses.
So i'm looking to basically convert the value to a binary number and just send each bit to a different variable to be able to capture multiple bits being on.
I've not done this in C, but converting to binary has always been common in the languages I've done this same task in. Is there a built in function within C that could do this conversion also?
FYI - I searched the boards and google quite a bit but was only able to find academic exercises of how to do this from scratch. This isn't for a class or anything academic. Honestly for my purposes, I'm not a programmer and its not really important "how" it works at all. Just to patch some old code that was written long ago lol.