我的学习笔记三:常见C++类型及相互转换
C++里用到的数据类型有很多,编程过程中很容易混用,下面综合看到的资料(由衷感谢无私共享的前辈们)对此进行简单的解析
一、1.常见字符的意义:
L:代表LONG
W:代表WIDE,也就是OLE,代表宽字节字符
P:代表POINTER
A:代表ANSIC,也就是MBCS多字节字符
S:代表String,有时用STR表示
C:代表Const
T:代表中间类型,即如果定义了_UNICODE则代表宽字节,如果定义了_MBCS则代表了多字节字符
2:代表TO ,意味转换为
2. char和CString
例如:(1)char * a="hello";
CString str=a;
(2)CString str="hello";
char * a;
a=str.GetBuffer(str.GetLength());
str.ReleaseBuffer();
(3)CString str="hello";
char a;
a=str.GetAt(i);
str.ReleaseBuffer();
(4)CString str="hello";
char a[100];
strcpy(a,str);
(5)CString mCS=_T("cxl");
char mch[20];
memcpy(mch,mCS,20);
(6)char *ch;
CString str;
ch=(LPSTR)(LPCTSTR)str;
3.int,float,double和CString
例如:(1)CString strval="12.43aa";
相关文档:
1. 使用TCHAR类型,定义在tchar.h中
#include <tchar.h>
#include <stdio.h>
int main()
{
TCHAR s[] = "你";
printf("%s \n",s);
return 0;
}
2.关于C++中文字符的处理
一 引入问题
代码 wchar_t a[3]=L”中国”,编译时出错,出错信息为:数组越界。但wchar_ ......
CAPTION: 关于C/C++中内存空间的划分
AUTHOR: aIsland 摘自中国IT实验室
DATE: 2010-05-30
E-MAIL: aIsland@live.cn
QQ: 418662213
P.S.
1.Bolanlan|随心high|aIsland 三个网名均为本人
2.声明aIsland 所收录的所有文章其著作权都属于原创作者
  ......
/*
* File: main.cpp
* Author: Vicky
*
* Created on 2010年5月8日, 下午2:47
*/
#include <iostream>
using namespace std;
void swap(int x, int y) {
cout << "x and y swap before : " << x << "\t" << y << endl;
int i = x;
x = y;
y = i; ......
1:在StaAfx.h 中添加如下代码 #import "C:\\Program Files\\Common Files \\System\\ado\\msado15.dll" no_namespace rename("EOF","adoEOF")rename("BOF","adoBOF")
2:在BOOL CXXXApp::InitInstance()中初始化COM环境
::CoInitialize(NULL);
释放COM环境
::CoUninitialize();
......
Linux/UNIX C++高级培训---远程班
http://www.xuanyuan-soft.cn/index.php?option=com_content&view=article&id=84&Itemid=85
课程概要
培养目标
:Linux/UNIX C++软件工程师
专注Linux/UNIX服务器端的软件开发(后台开发),培养企业所需的专业Linux/UNIX C ......