特级做A爰片毛片免费69,永久免费AV无码不卡在线观看,国产精品无码av地址一,久久无码色综合中文字幕

cstring 操作詳解[外文翻譯].doc

約17頁DOC格式手機(jī)打開展開

cstring 操作詳解[外文翻譯],cstring 操作詳解[外文翻譯]包括英文原文和中文翻譯英文:15300字9頁中文:5700字8頁cstrings are a useful data type. they greatly simplify a lot of operations in mfc, making it much more conveni...
編號:16-77249大小:86.00K
分類: 論文>外文翻譯

內(nèi)容介紹

此文檔由會員 8008008 發(fā)布

CString 操作詳解[外文翻譯]

包括英文原文和中文翻譯

英文:15300字 9頁
中文: 5700字 8頁




CStrings are a useful data type. They greatly simplify a lot of operations in MFC, making it much more convenient to do string manipulation. However, there are some special techniques to using CStrings, particularly hard for people coming from a pure-C background to learn. This essay discusses some of these techniques.

Much of what you need to do is pretty straightforward. This is not a complete tutorial on CStrings, but captures the most common basic questions.

CString concatenation
Formatting (including integer-to-CString)
Converting CStrings to integers
Converting between char * to a CString
char * to CString
CString to char * I: Casting to LPCTSTR
CString to char * II: Using GetBuffer
CString to char * III: Interfacing to a control
CString to BSTR
BSTR to CString (New 30-Jan-01)
VARIANT to CString (New 24-Feb-01)
Loading STRINGTABLE resources (New 22-Feb-01)
CStrings and temporary objects
CString efficiency
String Concatenation
One of the very convenient features of CString is the ability to concatenate two strings. For example if we have

CString gray("Gray");
CString cat("Cat");
CString graycat = gray + cat;
is a lot nicer than having to do something like ......




CString 操作詳解
原著:Joseph M. Newcomer
CString 是一種很有用的數(shù)據(jù)類型。它們很大程度上簡化了MFC中的許多操作,使得MFC在做字符串操作的時候方便了很多。不管怎樣,使用CString有很多特殊的技巧,特別是對于純C背景下走出來的程序員來說有點難以學(xué)習(xí)。這篇文章就來討論這些技巧。
  使用CString可以讓你對字符串的操作更加直截了當(dāng)。這篇文章不是CString的完全手冊,但囊括了大部分常見基本問題。
這篇文章包括以下內(nèi)容:
CString 對象的連接
格式化字符串(包括 int 型轉(zhuǎn)化為 CString )
CString 型轉(zhuǎn)化成 int 型
CString 型和 char* 類型的相互轉(zhuǎn)化
char* 轉(zhuǎn)化成 CString
CString 轉(zhuǎn)化成 char* 之一:使用LPCTSTR強(qiáng)制轉(zhuǎn)化
CString 轉(zhuǎn)化成 char* 之二:使用CString對象的GetBuffer方法
CString 轉(zhuǎn)化成 char* 之三: 和控件的接口
載入字符串表資源;
CString 和臨時對象;
CString 的效率;
總結(jié)
下面我分別討論。
1、CString 對象的連接
  能體現(xiàn)出 CString 類型方便性特點的一個方面就字符串的連接,使用 CString 類型,你能很方便地連接兩個字符串,正如下面的例子:
CString gray("Gray");
CString cat("Cat");
CString graycat = gray + cat;
要比用下面的方法好得多:
char gray[] = "Gray";
char cat[] = "Cat";
char * graycat = malloc(strlen(gray) + strlen(cat) + 1);
strcpy(graycat, gray);
strcat(graycat, cat) ......