8byte变1byte
00100000010000001000000100000010000000这八个byte每个只取一个bit再组合成一个byte,怎么变成11111111,如何实现啊,求高手写下语句!
不明白你的具体意思
unsigned char SourceByte[] = {0x01,0x02,0x04,0x08,0x10,0x20,0x40,0x80};
unsigned char TargetByte = 0;
for(int i=0; i> j) & 0x01)
{
TargetByte |= (1> i) & 0x01)
TargetByte |= (1<
如果八个字节位不重叠的话,直接相加就可以了。
楼上的代码很不错了 只是有点繁琐了,下面是更简单的代码 u n s i g n e d c h a r s ou rce Byte[] = { 0x 01,0x02,0x 04,0x 08,0x 10,0x 20,0 x40,0 x80}; u n sign ed ch ar tar getByte = 0; for(int i=0; i++; i<8) { t arget Byte |= sour ceB yte[i]; }
答:这问题用grep 或者sed更容易,一行搞定 $sed -n '/lodf/p' src.txt >out.txt 或者 $grep 'lodf' src.tx...详情>>
问:挺简单的一C函数,不过我是初学者,暂时还不会写,请好心人多多帮忙!
答:int mystrlen(char *str) { int n = 0; while (*str) { n++; str++;} return n; } voi...详情>>