读书人

C# 与BCB其间的转换

发布时间: 2012-12-15 15:16:03 作者: rapoo

C# 与BCB之间的转换!
C#中的下列语句怎么变成可以使用的BCB语句 求解
byte[] bs = {97, 98, 99, 100, 101, 102};
  string ss = System.Text.Encoding.ASCII.GetString(bs);
  this.textBox1.AppendText("The string is: " + ss + "\n");

  运行结果为:The string is: abcdef


Come from http://www.dzwebs.net Article Url??http://www.dzwebs.net/3121.html
[最优解释]
本帖最后由 ccrun 于 2012-11-05 09:45:53 编辑

byte bs[] = { 97, 98, 99, 100, 101, 102, 0x0 };
Memo1->Lines->Add(String("The string is: ") + (char *)bs);

[其他解释]

unsigned char bs[] = { 97, 98, 99, 100, 101, 102, 0x0 };
Memo1->Lines->Add(String("The string is: ") + (char *)bs);
[其他解释]
强制转一下就行了
unsigned char bs[] = { 97, 98, 99, 100, 101, 102, 0x0 };
unsigned和“*”之类的类型问题就像下面强制转一下
String((char *)bs);
[其他解释]
这个不行耶!
[其他解释]
引用:
这个不行耶!


那么,你想实现啥?
[其他解释]
byte就是unsigned char,C++Builder可以识别。

现在需要知道楼主到底想要什么。
[其他解释]
byte[] bs = {97, 98, 99, 100, 101, 102};
  string ss = System.Text.Encoding.ASCII.GetString(bs);
  this.textBox1.AppendText("The string is: " + ss + "\n");

  运行结果为:The string is: abcdef

就是要在C++builder 2010 中实现上述代码的转换, 我按照各位大虾给的代码去执行了。出错了,说是unsigned和“*”之间有问题。不过我用其他方法解决了我要实现的了!谢谢各位大虾哈!
[其他解释]
默认是cb6的代码

读书人网 >C++ Builder

热点推荐