随笔 - 26  文章 - 6  trackbacks - 0
<2009年9月>
303112345
6789101112
13141516171819
20212223242526
27282930123
45678910

常用链接

留言簿(3)

随笔分类

随笔档案

朋友

  • cqh
  • 大学室友...

搜索

  •  

最新评论

阅读排行榜

评论排行榜

#include <iostream>
#include 
<windows.h> 
#include 
<TCHAR.h>
#include 
<StrSafe.h>
using namespace std;



int main()
{
    
//WinNt中TCHAR和TEXT的使用
    TCHAR c = TEXT('A');
    TCHAR sz[
100= TEXT("A String");
    printf(
"the size of c is %d, sz is %d\n"sizeof(c), sizeof(sz));
    
    
//tchar中函数的运用
    _tcscat(sz, TEXT("Add"));
    _tprintf(TEXT(
"The %s's length is %d\n"), sz, _tcslen(sz));

    
//safe函数的使用
    TCHAR sz2[20];
    _tcscpy_s(sz2, _countof(sz2), sz);        
//第二个参数为缓冲区大小
    _tprintf(TEXT("The %s's length is %d\n"), sz2, _tcslen(sz2));

    
return 0;
}

posted on 2009-11-21 11:48 longshen 阅读(429) 评论(0)  编辑 收藏 引用 所属分类: VC++

只有注册用户登录后才能发表评论。
网站导航: 博客园   IT新闻   BlogJava   知识库   博问   管理