|
-
Dec 9th, 2003, 10:21 AM
#1
Thread Starter
Junior Member
data assignment
I am using an old version of MS C++ compiler 1.5 and want to be able to assign a binary value directly to a variable. I know how to assign hex, decimal, long and octal values but not binary. For example:
unsigned char MyVal = 5;
needs to be
unsigned char MyVal = 00000101;
Thanks for any help.
-
Dec 9th, 2003, 11:18 AM
#2
transcendental analytic
any reason for this? c++ doesn't allow that but you can make up some templates that does it at compile time or use atoi at runtime but thats just a waste of time both compile design and runtime if you ask me. if its just for aestetic reasons forget about it and write in hex and get on with it, or choose another language.
Use  
writing software in C++ is like driving rivets into steel beam with a toothpick.
writing haskell makes your life easier:
reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.
-
Dec 9th, 2003, 11:31 AM
#3
Thread Starter
Junior Member
I am porting over a driver for a graphics LCD display that was originally written in assembler and already have the 256 char bitmapped character set that i want to use. This saves me having to go through and convert every character manually (8x8 font, lots of conversion). If there is no way to do this i will have to write something to read the file and automate the conversion. Thanks.
-
Dec 9th, 2003, 11:37 AM
#4
transcendental analytic
Use  
writing software in C++ is like driving rivets into steel beam with a toothpick.
writing haskell makes your life easier:
reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|