OdinXp2000
asked on
how can I change 10 bit data into 2 bit data
it means change a dec number into a bin number
We're not allowed to answer homework questions, unfortunately, so I doubt you're going to get a reply to this one.
What do you mean by change 10 bit data into 2 bit data?
throw 8 bits away. But why?
keep the most significant 2 bits. This can be done for images, for example. Convert 256 to 16 color depth, just keep the top bits and its a rough way to do that...
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
example:
#include <stdio.h>
void main () {
char InputString[] = "1047";
char OutputString[5];
int Value;
int Ret;
/* Convert decimal string to internal format*/
/* internaly its binary*/
Ret = sscanf ( InputString, "%d", &Value);
if ( Ret != 1 ) { exit -1; }
/* Convery internal representation binary to binary string */
}
#include <stdio.h>
void main () {
char InputString[] = "1047";
char OutputString[5];
int Value;
int Ret;
/* Convert decimal string to internal format*/
/* internaly its binary*/
Ret = sscanf ( InputString, "%d", &Value);
if ( Ret != 1 ) { exit -1; }
/* Convery internal representation binary to binary string */
}
ASKER
Thank all of you very much!