November 15th, 2004, 06:20 AM
Join Date: Nov 2004
Time spent in forums: 22 h 49 m 55 sec
Reputation Power: 10
converting binary into an int
What would be the best c++ data type to store a binary number? Should i store it in a long,float,double,etc..
I would like to output user inputted data on the parallel port letter by letter. How would i go about processing the char array? When i do get the value that it should be in binary how do i convert it back into an int so that i can easily output it using _out(0x378,data);
To process the data should i just use a long string of if functions to turn each possible character into its binary equivelent? or is there some algorithm to process it and store the results for comparison and analysis?
buffer=01000000; //store binary equivelent of @
... if statements continue
if i did this what data type should buffer be?
then how would i convert the value stored into an int?
also is there a better way to convert letter->binary->int ->output on port
Thanks for the help