Location:
Search - cstring char
Search list
Description: 打开一个TXT文件并显示在EDIT控件中
步骤:
1.新建一个基于对话框的工程,名称为ReadFile
2.在界面上添加一个按钮(IDC_BUTTON1)和一个文本编辑(IDC_EDIT1)
IDC_EDIT1的属性:多行、可下拉滚动条.
3.编辑按钮触发事件(void CReadFileDlg::OnButton1())
void CReadFileDlg::OnButton1()
{
// TODO: Add your control notification handler code here
CString sFileFilter=\"*.hex|*.hex\"
CString sFileName
CFileDialog fDlg(true,NULL,NULL,OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT,sFileFilter,NULL)
fDlg.DoModal()
sFileName=fDlg.GetFileName()
if(sFileName!=\"\")
{
CFile file(sFileName,CFile::modeRead)
int nFileLength=file.GetLength()
char *buffer
HGLOBAL hgl=::GlobalAlloc(GMEM_MOVEABLE,nFileLength+1)
buffer=(char *)::GlobalLock(hgl)
file.Read(buffer,nFileLength)
SetDlgItemText(IDC_EDIT1,buffer)
::GlobalUnlock(hgl)
::GlobalFree(hgl)
}
UpdateData(false)
}
Platform: |
Size: 26089 |
Author: 这程子 |
Hits:
Description: CharAndCString,Char和CString
Platform: |
Size: 32199 |
Author: lijunmin |
Hits:
Description: Visual C++ 2005中CHAR,TCHAR,CString间转换函数
Platform: |
Size: 1217 |
Author: carl yuheng |
Hits:
Description: CharAndCString,Char和CString-CharAndCString, Char and CString
Platform: |
Size: 4187136 |
Author: lijunmin |
Hits:
Description: Visual C++ 2005中CHAR,TCHAR,CString间转换函数-Visual C++ 2005 in CHAR, TCHAR, CString intergovernmental transfer function
Platform: |
Size: 1024 |
Author: carl yuheng |
Hits:
Description: vc中常用数据格式转换,如wchar_t,char*,CString,int等。-vc commonly used data format conversion, such as wchar_t, char*, CString, int, etc..
Platform: |
Size: 1024 |
Author: zhang lz |
Hits:
Description: C++ int,char,string,CString类型转换-int,char,string,CString datatype-transform in C++
Platform: |
Size: 1024 |
Author: sjunme |
Hits:
Description: 这是本人根据某个项目写的数据转换辅助函数:包括ASCII转CString\char或反过程,以及数的求模等-This is why I write under a project data conversion support functions include: ASCII transfer CString \ char or anti-process, and seek the number of molds for
Platform: |
Size: 1938432 |
Author: 谢仙圣 |
Hits:
Description: char和CString之间赋值的问题,包含char* 转化成 CString,CString 转化成 char* ,BSTR 型转化成 CString 型等等。-between the char and CString assignment problem with char* into a CString, CString into a char*, BSTR type into CString type and so on.
Platform: |
Size: 15360 |
Author: lizhiqian |
Hits:
Description: 字符串操作是一个不小的主题,在标准C++中,string字符串类成为一个标准,之所以抛弃char*的字符串而选用C++标准程序库中的string类,是因为他和前者比较起来,不必担心内存是否足够、字符串长度等等,而且作为一个类出现,他集成的操作函数足以完成我们大多数情况下的需要.
下面我们首先从一些示例开始学习下string类的使用.-i nclude <string>
#i nclude <iostream>
using namespace std
void main()
{
Platform: |
Size: 2048 |
Author: qiannuo |
Hits:
Description: VC编程技巧大会总
1、VC++常用数据类型(1)
一.VC常用数据类型列表
二.常用数据类型转化
2.1 数学类型变量与字符串相互转换
2.2 CString 及 string,char *与其他数据类型的转换和操作
●CString,string,char*的综合比较
●数学类型与 CString 相互转化
●CString与 char*相互转换举例
●CString 与 BSTR 型转换
●VARIANT 型转化成 CString 型
2.3 BSTR、_bstr_t 与 CComBSTR
2.4 VARIANT 、_variant_t 与 COleVariant
附录 CString 及字符串转及操作详解
参考书籍:CSDN,<<MFC深入浅出(Second Edit)>>
一.VC常用数据类型列表 -VC编程技巧大会总
1、VC++常用数据类型(1)
一.VC常用数据类型列表
二.常用数据类型转化
2.1 数学类型变量与字符串相互转换
2.2 CString 及 string,char*与其他数据类型的转换和操作
●CString,string,char*的综合比较
●数学类型与 CString 相互转化
●CString与 char*相互转换举例
●CString 与 BSTR 型转换
●VARIANT 型转化成 CString 型
2.3 BSTR、_bstr_t 与 CComBSTR
2.4 VARIANT 、_variant_t 与 COleVariant
附录 CString 及字符串转及操作详解
参考书籍:CSDN,<<MFC深入浅出(Second Edit)>>
一.VC常用数据类型列表
Platform: |
Size: 98304 |
Author: 郑梅 |
Hits:
Description: str ()的简单实现
strstr(s1,s2)是一个经常用的函数,他的作用就是在字符串s1中寻找字符串s2如果找到了就返回指针,否则返回NULL。-
static const char* _strstr(const char* s1, const char* s2)
{
assert(s2 && s1)
const char* p=s1,*r=s2
while(*p!= \0 )
{
while(*p++==*r++)
if(*r== \0 )
return p
else
{
r=s2
p=++s1
}
}
return NULL
}
Platform: |
Size: 3072 |
Author: qddqdd |
Hits:
Description: CString,float,int,long,String,char *,char[],之间的转换-CString, float, int, long, String, char, char*, char [], the conversion between
Platform: |
Size: 3072 |
Author: 陈伟源 |
Hits:
Description: UNICODE下宽字符的CString转换为const char 和char到WCHAR的相互转换-Under the wide character UNICODE CString convert to WCHAR const char and char conversion between
Platform: |
Size: 2048 |
Author: hillriver |
Hits:
Description: 本字符串类可以直接用 , =,[],==操作符,并可在需要时直接转化为char*类型,程序把cpy(char*)及cat(char*)函数放在protected节中,方便在扩展本类时,进行继承并简化使用-The string class can be used directly++ =, [], the == operator, and may need to translate directly into char* type, the program cpy (char*) and cat (char*) function on the protected section to facilitate the expansion of the class, inherit and to simplify the use of
Platform: |
Size: 1024 |
Author: zhaobin |
Hits:
Description: 本程序实现了CString、char*之间的转换,是适合初学者的很好的学习材料。-This program implements the conversion between CString char* is a good learning material for beginners.
Platform: |
Size: 1884160 |
Author: chenjun |
Hits:
Description: Cstring转char、string、int等数据类型的方法,这是我们VC编程经常用到的方法,希望对大家有用!-The transfected char, string, int data type in Cstring. Txt
Platform: |
Size: 2048 |
Author: 黄德才 |
Hits:
Description: CString与LPCWSTR、LPSTR、char*、LPWSTR等类型的转换-CString and LPCWSTR, LPSTR, char*, LPWSTR other type of conversion
Platform: |
Size: 5120 |
Author: 刘文 |
Hits:
Description: UNICODE下宽字符的CString转换为const char 和char到WCHAR的相互转换-Under the wide character UNICODE CString convert to WCHAR const char and char conversion between
Platform: |
Size: 2048 |
Author: questionab |
Hits:
Description: Unicode下CString与char_转换-Unicode CString and char_ conversion under
Platform: |
Size: 14336 |
Author: jockey |
Hits: