C++ lstrlen()

关于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中的运行结果:

 

posted @ 2018-01-06 12:22  heismk  阅读(904)  评论(0编辑  收藏  举报