第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號安全,請及時綁定郵箱和手機(jī)立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

麻煩介紹下void send()等函數(shù)

麻煩介紹下void send()等函數(shù)

C++
慕桂英3389331 2023-01-13 15:11:29
代碼如下:unsigned char32 Slave_adr[8];unsigned char32 Slave_Send_adr[73];void bit_set(int32 x,int y){ int32 temp;temp=1;temp=temp<<y;x=x|temp;}void bit_clear(int32 x,int y){ int32 temp;temp=1;temp=temp<<y;temp=~temp;x=x&temp;}int1 bit_test(int32 x,int y){ int32 temp;temp=1;temp=temp1<<y;temp=x&temp;if(temp) return(1);else return(0);}//輸入?yún)?shù):x為從機(jī)號碼;void Slave_Address_set_bit(unsigned char *buff){ unsigned char quotient_Value; //用來放商值;unsigned char residue_Value; //用來放余數(shù);unsigned char x;x=atoi(buff);quotient_Value=x/32;residue_Value=x%32;bit_set(Slave_adr[quotient_Value],residue_Value); //更新Slave_adr[];}//輸入?yún)?shù):x為從機(jī)號碼;void Slave_Address_clear_bit(unsigned char *buff){ unsigned char quotient_Value; //用來放商值;unsigned char residue_Value; //用來放余數(shù);unsigned char x;x=atoi(buff);quotient_Value=x/32;residue_Value=x%32;bit_clear(Slave_adr[quotient_Value],residue_Value); //更新Slave_adr[];}//輸入?yún)?shù):x為從機(jī)號碼;bit Slave_Address_test_bit(unsigned char *buff){ unsigned char quotient_Value; //用來放商值;unsigned char residue_Value; //用來放余數(shù);unsigned char x;x=atoi(buff);bit temp_bit;quotient_Value=x/32;residue_Value=x%32;temp_bit=bit_test(Slave_adr[quotient_Value],residue_Value);return(temp_bit);}//函數(shù)功能:將Slave_adr[]中的數(shù)據(jù)轉(zhuǎn)換為16進(jìn)制ASCii碼,保存到Slave_Send_adr[]中void send(){ signed char i;unsigned char temp_array[5];int temp;memset(Slave_Send_adr,'\0',73);for(i=7;i>=0;i--){ memset(temp_array,'\0',5);temp=(int)(Slave_adr[i]>>4);sprintf(temp_array,"%Lx",temp); //將高16位轉(zhuǎn)換為16進(jìn)制ASCii碼;strcat(Slave_Send_adr,temp_array);temp=(int)Slave_adr[i];sprintf(temp_array,"%Lx",temp); //將低16位轉(zhuǎn)換為16進(jìn)制ASCii碼;strcat(Slave_Send_adr,temp_array);memset(temp_array,'\0',5);strcpy(temp_array,";")strcat(Slave_Send_adr,temp_array);}}如果麻煩就只翻譯unsigned char32 Slave_adr[8];unsigned char32 Slave_Send_adr[73];和這三個函數(shù)void bit_set(int32 x,int y)void Slave_Address_set_bit(unsigned char *buff)void send()
查看完整描述

2 回答

?
慕尼黑的夜晚無繁華

TA貢獻(xiàn)1864條經(jīng)驗 獲得超6個贊

//char32不清楚什么類型,就當(dāng)INt32了

Int32[] Slave_adr = new Int32[8];
Int32[] Slave_Send_adr = new Int32[73];
void bit_set(Int32 x, int y)
{
Int32 temp;
temp = 1;
temp = temp << y;
x = x | temp;
}
void Slave_Address_set_bit(byte[] buff)
{
char quotient_Value; //用來放商值;
char residue_Value; //用來放余數(shù);
char x;
x = BitConverter.ToChar(buff, 0);
quotient_Value = x / 32;
residue_Value = x % 32;
bit_set(Slave_adr[quotient_Value], residue_Value); //更新Slave_adr[];
}

只翻譯了這么多,第三個很煩,直接翻譯很難。
memset還好,strcat,sprintf,strcpy等等還要翻譯
如果知道要實現(xiàn)什么轉(zhuǎn)換,就可以自己要C#寫段函數(shù)了

查看完整回答
反對 回復(fù) 2023-01-15
?
白板的微信

TA貢獻(xiàn)1883條經(jīng)驗 獲得超3個贊

unsigned char32 這什么類型?沒用過,c#中應(yīng)該用:char就可以。

unsigned char temp_array[5];改為:char[] temp_array = new char[5];
memset(temp_array,'\0',5);就用不到了。

運算符功能基本都是一樣的,
void Slave_Address_set_bit(unsigned char *buff)

改為:
void Slave_Address_set_bit(ref char[] buff)

其它沒什么了吧 


查看完整回答
反對 回復(fù) 2023-01-15
  • 2 回答
  • 0 關(guān)注
  • 174 瀏覽

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動學(xué)習(xí)伙伴

公眾號

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號