摘要: 字符串string转换为其它数据类型 int atoi(const char *nptr); string str="123456"; temp=str.c_str(); 1)短整型(int)i = atoi(temp);2)长整型(long)l = atol(temp);3)浮点(double)d 阅读全文
posted @ 2018-11-22 19:30 kuaqi 阅读(813) 评论(0) 推荐(0) 编辑
摘要: // Cast a dynamically allocated string to 'void*'. void *vp = static_cast<void*>(new std::string("it's easy to break stuff like this!")); // Then, in 阅读全文
posted @ 2018-11-22 19:13 kuaqi 阅读(196) 评论(0) 推荐(0) 编辑
摘要: string、char[]、char*、const char*; 输出都一样 printf只能输出c语言中的内置数据,string不是c语言内置数据; cout可以输出string字符串,是因为string中重载了“<<”操作符; printf_s("%s\n", arrc); \\char[]pr 阅读全文
posted @ 2018-11-22 19:09 kuaqi 阅读(249) 评论(0) 推荐(0) 编辑
摘要: 在处理LPTSTR或LPCTSTR的时候,应该使用_tcslen来替代strlen函数。否则,在Unicode编码方式下,strlen不能处理wchar_t*的字符串。 阅读全文
posted @ 2018-11-22 18:55 kuaqi 阅读(392) 评论(0) 推荐(0) 编辑
摘要: 格式: CString cstr.AppendFormat(_T(" %.4f "), ); 输出: (1) https://blog.csdn.net/overlord_bingo/article/details/60140224 不含中文的情况下: CString s("hello world" 阅读全文
posted @ 2018-11-22 18:25 kuaqi 阅读(242) 评论(0) 推荐(0) 编辑