请问以下C代码如何在VB中实现? unsigned char buf[1024];memset( buf, 0, sizeof(buf) );buf[0]=0xef;buf[1]=0x14;memcpy( buf+2, "something here", 14 ); 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 unsigned char buf[1024];dim buf as stringmemset( buf, 0, sizeof(buf) );string=""buf[0]=0xef;string = &Hefbuf[1]=0x14;string =string + (&H14)memcpy( buf+2, "something here", 14 );string =string + "something here" To :ydzqw(===七条狗===) thank you. 还有一个问题,如果用socket将这一串string发给unix的机器,unix同样是用socket接收,收下来的首位&Hef会不会不一致?因为现在实际情况首位收到的不是&Hef,第二个字节是正常的是&H14。 有两种方式可以实现方式一unsigned char buf[1024];----Dim strBuf as stringmemset( buf, 0, sizeof(buf) );buf[0]=0xef;----strBuf=chrw(&Hef) ''注意 是chrw函数,不是chr函数buf[1]=0x14;----strBuf=strBuf & chrw(&H14)memcpy( buf+2, "something here", 14 );----strBuf=strBuf & "Something here" 方法二,采用二进制方式,虽然烦琐,但可靠unsigned char buf[1024];----Dim abtBuf(1024) as byte----Dim i as Integer----Dim strTmp as stringmemset( buf, 0, sizeof(buf) );buf[0]=0xef;----abtBuf(0)=&HEFbuf[1]=0x14;----abtBuf(1)=&H14memcpy( buf+2, "something here", 14 );----strTmp="Something Here"----For i=2 to len(strTmp) abtBuf(i)=cByte(Asc(Mid(strTmp,i-1,1))) Next 看大家都幸福着呢…… 送分100分:text1.text = rst1.fields("姓名") 时出现无效使用NULL的提示 这几句中的感叹号代表什么呀? 对系统进行高级控制的问题 新手提问:关于VB和SQL 请教,数据库问题,高手请进! agent 有关datagird,想取当前‘行’数据的任意一项或多项,显示在其他页面! 在VB中如何将BMP图片转变为JPG和GIF图片? 如何在WebBrowser控件中屏蔽右键 关于系统消息的问题,求助!!!!!!! 请问如何让工具栏(toolbar)中的按钮互斥的弹起?
dim buf as stringmemset( buf, 0, sizeof(buf) );
string=""buf[0]=0xef;
string = &Hefbuf[1]=0x14;
string =string + (&H14)memcpy( buf+2, "something here", 14 );
string =string + "something here"
thank you.
还有一个问题,如果用socket将这一串string发给unix的机器,unix同样是用socket接收,收下来的首位&Hef会不会不一致?因为现在实际情况首位收到的不是&Hef,第二个字节是正常的是&H14。
方式一
unsigned char buf[1024];
----Dim strBuf as stringmemset( buf, 0, sizeof(buf) );
buf[0]=0xef;
----strBuf=chrw(&Hef) ''注意 是chrw函数,不是chr函数
buf[1]=0x14;
----strBuf=strBuf & chrw(&H14)
memcpy( buf+2, "something here", 14 );
----strBuf=strBuf & "Something here"
unsigned char buf[1024];
----Dim abtBuf(1024) as byte
----Dim i as Integer
----Dim strTmp as stringmemset( buf, 0, sizeof(buf) );
buf[0]=0xef;
----abtBuf(0)=&HEFbuf[1]=0x14;
----abtBuf(1)=&H14memcpy( buf+2, "something here", 14 );
----strTmp="Something Here"
----For i=2 to len(strTmp)
abtBuf(i)=cByte(Asc(Mid(strTmp,i-1,1)))
Next