cfile

File Operations

烈酒焚心 提交于 2019-12-09 16:56:37
For example: UpdateData(TRUE); CFileDialog dlg(1,NULL,NULL,OFN_HIDEREADONLY ,"All Files(*.*)|*.*||"); if(IDOK!=dlg.DoModal())return; m_filename=dlg.GetPathName(); UpdateData(FALSE); When user click browse button, the function UpdateData(TRUE) will refresh the value from controls to variables. As the same reason, the function UpdateData(FALSE) will refresh the value from variables to controls. #How to open a file with a dialog? The code CFileDialog dlg(1,NULL,NULL,OFN_HIDEREADONLY ,"All Files(*.*)|*.*||"); is supposed to open any files. The following hyperlink contains how to use the

curl post file PHP

◇◆丶佛笑我妖孽 提交于 2019-12-04 07:44:00
###网上示例方式 使用@加上文件名 如aa.png => @aa.png ###使用结果 PHP5.5以下可行,PHP5.5以上进行了封装 ###PHP5.5及以上版本 php5.5及以上版本封装了一个CURLFile类, 详情 ###示例 $ch = curl_init('https://example.com'); $cfile = new CURLFile('aa.png','image/jpeg','image_name'); //建立文件 $post_data = array( "image_name" => "bar", "image" => $cfile ); curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);//关闭认证 curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);//关闭认证 //curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC); // curl_setopt($ch, CURLOPT_USERPWD, ""); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT

abaqus 子程序内部变量输出

烂漫一生 提交于 2019-12-03 11:15:01
do kblock = 1, nblock c data output and output frequence unit=1000+kblock outdir='' c 输出时间间隔 outputstep=0.02 noutputstep=period/outputstep c 工作目录调用 CALL VGETOUTDIR( OUTDIR, LENOUTDIR ) do i =1,noutputstep time_tol=abs(i*outputstep-time(1)) if ((time_tol).gt.(0.0001)) then continue else c 按单元号生成输出文本 write(cfile,'(i8.5,a4)') jelem(kblock),'.txt' cfile=TRIM(ADJUSTL(outdir))//'\'//TRIM(ADJUSTL(cfile)) open(unit, file=cfile, action="WRITE") write(unit,*) time(1) endif enddo end do 来源: https://www.cnblogs.com/structurer/p/11793129.html

UTF-8, CString and CFile? (C++, MFC)

匿名 (未验证) 提交于 2019-12-03 01:14:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I'm currently working on a MFC program that specifically has to work with UTF-8. At some point, I have to write UTF-8 data into a file; to do that, I'm using CFiles and CStrings. When I get to write utf-8 (russian characters, to be more precise) data into a file, the output looks like and etc. This is assurely not utf-8. To read this data properly, I have to change my system settings; changing non ASCII characters to a russian encoding table does work, but then all my latin based non-ascii characters get to fail. Anyway, that's how I do it.

MFC中数据文件的存储和加载

ε祈祈猫儿з 提交于 2019-12-02 23:53:42
1. 传统的数据存储,将数据定义到一个结构体中,用CFile的方式循环读写数据结构体 struct SData { UINT nNumb; TCHAR sName[20]; COleDateTime date; }; void CfffDlg::OnBnClickedSave() { //另存为对话框 CFileDialog fd(FALSE, _T("*.fff"), _T("example"), OFN_OVERWRITEPROMPT, _T("信息文件(*.fff)|*.fff|所有文件|*.*||"), NULL); if (IDCANCEL == fd.DoModal()) return; CFile file; if (!file.Open(fd.GetPathName(), CFile::modeCreate | CFile::modeWrite)) { MessageBox(_T("保存文件出错!"), _T("Tip")); return; } SData s; for (int i = 0; i < m_list.GetItemCount(); ++i) { s.nNumb = _ttoi(m_list.GetItemText(i,0)); m_list.GetItemText(i, 1, s.sName, sizeof(s.sName) / sizeof(s

MFC拾遗

余生颓废 提交于 2019-12-01 04:50:48
有时候要写个小工具给别人用,所以又把MFC用起来了,毕竟做个界面很简单,本文打算用来长期记录一些遇到的小问题和解决方法。 1 mfc选择一个文件,按钮响应中增加: BOOL isOpen = TRUE; //是否打开(否则为保存) CString defaultDir;// = L"E:\\FileTest"; //默认打开的文件路径 CString fileName = L""; //默认打开的文件名 CString filter = L"文件 (*.txt)|*.txt||"; //文件过虑的类型 //CFileDialog构造一个CFileDialog对象操作 CFileDialog openFileDlg(isOpen, defaultDir, fileName, OFN_HIDEREADONLY|OFN_OVERWRITEPROMPT, filter, NULL); //openFileDlg.GetOFN().lpstrInitialDir = L"E:\\FileTest\\test.txt"; //DoModal显示对话框并使用户可以进行选择 INT_PTR result = openFileDlg.DoModal(); CString filePath;// = defaultDir + "\\test.txt"; if(result == IDOK) { /

Directory Instruction

浪子不回头ぞ 提交于 2019-11-28 17:40:13
c++常用路径配置有以下几种: 在当前目录下创建文件夹: 1 CreateDirectory("NewFolder",NULL); 在指定的路径创建文件夹: 1 CreateDirectory("D:\\NewFolder",NULL); 在当前路径下创建打开文件: CString str1="NewFile.txt" c_flie.Open(str1,CFile::modeWrite|CFile::modeCreate); 在指定路径下创建打开文件: CString str1="NewFile.txt"; SetCurrentDirectory("D:\\Folder"); c_flie.Open(str1,CFile::modeWrite|CFile::modeCreate); 在当前目录下创建新文件夹,并在该文件夹下创建新的文件: 1 CString str1="NewFile.txt"; 2 CreateDirectory("NewFolder",NULL); 3 SetCurrentDirectory("NewFolder"); 4 c_flie.Open(str1,CFile::modeWrite|CFile::modeCreate); That's all. Thanks. 来源: https://www.cnblogs.com/lumao1122-Milolu/p

GetCurrentTime() and CFile option

早过忘川 提交于 2019-11-28 15:30:14
获取当前时间 CTime tm = CTime::GetCurrentTime(); 将当前时间转换成sctring类型+.txt 1 CString str2; 2 str2.Format(_T("%d%d%d_%d%d%d.txt"),tm.GetYear(),tm.GetMonth(),tm.GetDay(),tm.GetHour(),tm.GetMinute(),tm.GetSecond()); 将字符串定义为文件名称,并创建该文件,将编辑框内容写入文件内: 1 CFile c_flie; 2 if(c_flie.Open(str2,CFile::modeWrite|CFile::modeCreate)) 3 { 4 CString m_str; 5 CEdit *pEdit = (CEdit *)this->GetDlgItem(IDC_EDIT15); 6 pEdit->GetWindowText(m_str); 7 c_flie.Write(m_str,m_str.GetLength()); 8 c_flie.Close(); 9 } End thanks. 来源: https://www.cnblogs.com/lumao1122-Milolu/p/11412705.html

UTF-8, CString and CFile? (C++, MFC)

倖福魔咒の 提交于 2019-11-28 04:35:08
I'm currently working on a MFC program that specifically has to work with UTF-8. At some point, I have to write UTF-8 data into a file; to do that, I'm using CFiles and CStrings. When I get to write utf-8 (russian characters, to be more precise) data into a file, the output looks like Ðàñïå÷àòàíî: Ñèñòåìà Ïðîèçâîäñòâî and etc. This is assurely not utf-8. To read this data properly, I have to change my system settings; changing non ASCII characters to a russian encoding table does work, but then all my latin based non-ascii characters get to fail. Anyway, that's how I do it. CFile CSVFile( m