码迷,mamicode.com
首页 > 编程语言 > 详细

C++ lstrlen()

时间:2018-01-06 14:22:12      阅读:225      评论:0      收藏:0      [点我收藏+]

标签:img   span   操作   mic   char   block   net   int   byte   

关于lstrlen function,参考:https://msdn.microsoft.com/en-us/library/windows/desktop/ms647492(v=vs.85).aspx

 

 

以下代码摘自:http://blog.csdn.net/hczhiyue/article/details/6248229

另外,可参考:http://blog.csdn.net/dongpanshan/article/details/7898574

 

IDE: Code::Blocks 16.01

操作系统:Windows 7 x64

 1 #include <windows.h>
 2 #include <iostream>
 3 
 4 using namespace std;
 5 
 6 int main(int argc, _TCHAR* argv[])
 7 {
 8     char str1[] = "I‘m a Chinese.";
 9 
10     // Determines the length of the specified string (not including the terminating null character).
11     cout << lstrlen((LPCTSTR)str1) << " bytes" << endl;
12 
13     // Determines the length of the specified string (including the terminating null character).
14     cout << sizeof(str1) << " bytes" << endl;
15 
16     return 0;
17 }

 

在Code::Blocks 16.01中的运行结果:

技术分享图片

 

C++ lstrlen()

标签:img   span   操作   mic   char   block   net   int   byte   

原文地址:https://www.cnblogs.com/Satu/p/8213869.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!