摘要:string name = "Ambition";GBKToUTF8(name,"GBK","UTF-8"); //需要转换什么编码只需要更改后面2个参数。万能的(嘎嘎。。。。)游戏开发群:44727718int JCStrCoding::GBKToUTF8(string &gbkStr,const char* toCode/*="gbk"*/,const char* fromCode/*="utf-8"*/){ iconv_t iconvH; iconvH = iconv_open(f
阅读全文
摘要:最近我们开发过程中用到google/protobuf,因为之前没有接触过。网上的资料都是互相复制转载的。基本上都是讲protobuf 怎么赋值怎么取值。。。主要的消息映射讲的微乎其微。。。。。我根据网上说的做了下。。。问题我纠缠死了。。。-_-# OK 看代码 1 GOOGLE_PROTOBUF_VERIFY_VERSION; 2 string str = ""; 3 4 tutorial::AddressBook address_book; 5 tutorial::Person *person = tutorial::Person::default_instance().
阅读全文
摘要:现在我们需要从一个C/C++语言生成的二进制文件中读出一个float数据Java代码//参见java.io.DataInputStream //C++写入的字节顺序是从低到高(左低到右高), 而java.io.DataInputStream读取的数据是从高到低(左高到右低) //所以需要自己改写一下 //功能和java.io.DataInputStream类似的 publicclassCppInputStreamextendsFilterInputStream{ publicCppInputStream(InputStreamin){ super(in); } publicfinalintre
阅读全文
摘要:intsocket(int family, int type, int protocol);Creates a socket. Currentlyfamilycan only beAF_INET(OT does not support IPv6 so there is no AF_INET6 support).protocolcan bePF_INETorPF_UNSPEC(both have the same effect of creating an internet socket.typecan beSOCK_STREAMfor TCP sockets orSOCK_DGRAMfor U
阅读全文