代码改变世界

阅读排行榜

(转)CString,int,string,char*之间的转换

2013-11-30 19:18 by hongjiumu, 523 阅读, 收藏,
摘要: CString,int,string,char*之间的转换http://www.cnblogs.com/greatverve/archive/2010/11/10/cstring-int-string-char.html《C++标准函数库》中说的 有三个函数可以将字符串的内容转换为字符数组和C—string 1.data(),返回没有”\0“的字符串数组 2,c_str(),返回有”\0“的字符串数组 3,copy() ................................................................. int 转 CString: CString 阅读全文

通过Assembly来创建Type Instance

2012-12-29 11:58 by hongjiumu, 507 阅读, 收藏,
摘要: 通过Assembly来创建Type Instance1,object obj=System.Reflection.Assembly.Load("assemblyname").CreateInstance("namespace.classname");//Assembly.Load takes a assembly name, not a file path(not include the tail of ".dll")ClassLib.User user=obj as ClassLib.User;Result:user is not 阅读全文

(转)探索C++的秘密之详解extern "C",这就是为什么很多.lib被我们正确调用确总是无法解析的。

2014-01-18 21:24 by hongjiumu, 498 阅读, 收藏,
摘要: (转载,绝对的有用)lib被我们正确调用确总是无法解析。这是C++编译和C编译的区别时常在cpp的代码之中看到这样的代码: #ifdef __cplusplus extern "C" { #endif //一段代码 #ifdef __cplusplus } #endif 这样的代码到底是什么意思呢?首先,__cplusplus是cpp中的自定义宏,那么定义了这个宏的话表示这是一段cpp的代码,也就是说,上面的代码的含义是:如果这是一段cpp的代码,那么加入extern "C"{和}处理其中的代码。 要明白为何使用extern "C", 阅读全文

c++中const使用详解

2014-01-18 21:12 by hongjiumu, 464 阅读, 收藏,
摘要: const在c++中是一个关键字,它限定一个变量不允许被改变。使用const在一定程度上可以提高程序的安全性和可靠性,另外,在观看别人代码的时候,清晰理解const所起的作用,对理解对方的程序也有一些帮助。和const相反的是mutable,mutable也是一个关键字,它的作用刚好和const相反,是说明这个变量可以被改变,即使是在被const限定的类的成员函数里面。一:const和一般的变量相结合。int const a = 10,与 const int a =10 这两种写法都是正确的,也是表达同一个意思。说明变量a不能不修改,这种用法大家都知道,所以不用多说。需要说明的是:const 阅读全文

Pointers and Strings

2013-09-09 19:26 by hongjiumu, 464 阅读, 收藏,
摘要: The special relationship between arrays and pointers extends to C-style strings.Consider the following code:char flower[10]="rose";cout<<flower<<"s are red\n";The name of an array is the address of ite first element,so flower in the cout statement is the address of th 阅读全文
上一页 1 ··· 11 12 13 14 15 16 17 18 19 ··· 42 下一页