Location:
Search - getfilename
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: 获取目录中文件名及属性
Platform: |
Size: 93314 |
Author: fenglu |
Hits:
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)
}
-Open a TXT file and displayed in the EDIT control steps: 1. Create a new dialog-based project, known as the ReadFile2. In the interface to add a button (IDC_BUTTON1) and a text editor (IDC_EDIT1) IDC_EDIT1 properties: multi-line, can be drop-down scroll bar .3. Edit button trigger events (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: 1888256 |
Author: 这程子 |
Hits:
Description: 获取目录中文件名及属性-Access to directory file name and attributes
Platform: |
Size: 323584 |
Author: fenglu |
Hits:
Description: 这是一个可以获得文件名的源代码。可以用来获取文件的名称和路径~-This is a file name can get the source code. Can be used to obtain the file name and path ~
Platform: |
Size: 1024 |
Author: 肖宪 |
Hits:
Description: 使用Labview能获取输入文件的文件名,可根据自己的需要修改,使用版本为Lv8.5.-Use Labview to obtain input file file name ,can be modified according to your needs, the version is Lv8.5.
Platform: |
Size: 7168 |
Author: Libra Chow |
Hits:
Description: 本软件可以实现获得你选取文件的文件名,并将每个文件名自动带上单引号,同时将结果放入剪贴板,这样利于matlab对多文件处理。-daf
Platform: |
Size: 8192 |
Author: yo |
Hits:
Description: 读取 文件夹下所有文件名 整理到一个TXT文档中-read file and file name input txt
Platform: |
Size: 20480 |
Author: lbb |
Hits:
Description: get file s name in recursively
Platform: |
Size: 15360 |
Author: luy |
Hits:
Description: 这是一个可以获得文件名的源代码。可以用来获取文件的名称和路径~-This is a file name can get the source code. Can be used to obtain the file name and path ~
Platform: |
Size: 1024 |
Author: rkingt |
Hits:
Description: 获取带存放文件路径中的文件名称,主要可以用于获取上传路径里的文件或做其他用途-FOR GET FILE NAME
Platform: |
Size: 1024 |
Author: 米米 |
Hits:
Description: 使用C++实现提取文件夹中所有文件的名字,可以得到名字的全称或者名字+扩展名-get all the file name in the folder
Platform: |
Size: 2048 |
Author: 尹创业 |
Hits:
Description: 非常简单的一个关于BCB文件拖拽的简单例子-A simple example of BCB on file drag
Platform: |
Size: 104448 |
Author: 傅伟 |
Hits:
Description: 当我们拿着一个URL从百度音乐下载歌曲时候,URL中没有歌曲名,但是迅雷什么的下载工具却能知道这首歌曲的名字,我用CURL库下载怎么才能知道这个歌曲名称呢,断断续续研究了好几次都未果,这次终于找到方法了。
用CURLOPT_DEBUGFUNCTION > CURLINFO_HEADER_IN中检索到想到的数据了。-CURLOPT_DEBUGFUNCTION CURLINFO_HEADER_IN fetch Content-Dispostion: attachment filename
Platform: |
Size: 5120 |
Author: 朱洪祥 |
Hits:
Description: 本例用于实现从文件路径中获取文件名的功能。通过使用Dir函数从路径中提取文件名。-This example uses the filename and achieve access to functions the file path.
Platform: |
Size: 5120 |
Author: 孙联合 |
Hits: