Cfile关于打开文件的操作
来源:互联网 发布:webgl编程指南 pdf 编辑:程序博客网 时间:2024/05/16 11:50
1.简单的从Char到我们Cfile中需要的类型
#include <iostream>#include <afx.h>using namespace std ;int main(){//写CFile cfile;const char* msg="ab.txt"; wchar_t *wmsg = new wchar_t[strlen(msg)+1]; //memory allocationmbstowcs(wmsg, msg, strlen(msg)+1);cfile.Open(wmsg, CFile::modeCreate | CFile::modeReadWrite);char pbufWrite[100];memset(pbufWrite, 'a', sizeof(pbufWrite));cfile.Write(pbufWrite, 100); cfile.Flush();delete []wmsg;system("pause");}2.不用char类型,直接用_T类型的方法
#include <iostream>#include <afx.h>using namespace std ;int main(){CFile cfile;TCHAR* pszFileName = _T("f.txt");cfile.Open(pszFileName, CFile::modeCreate | CFile::modeReadWrite);char pbufWrite[100];memset(pbufWrite, 'a', sizeof(pbufWrite));cfile.Write(pbufWrite, 100); cfile.Flush();system("pause");}
0 0
- Cfile关于打开文件的操作
- 关于CFile类打开文件的默认路径
- CFile类打开文件的有趣现象
- CFile类打开文件的有趣现象
- MFC的文件操作 CFile类
- MFC CFile类操作文件的方法
- CFile类对文件的操作
- MFC文件操作的另一个思路CFile
- CFile文件操作
- CFile文件操作详解
- CFile文件操作
- MFC文件操作(CFile)
- vc++ cfile 文件操作
- MFC文件操作(CFile)
- 【MFC】CFile操作文件
- CFile文件操作示例
- CFile打开文件模式总结
- CFile 打开文件失败处理
- leetcode:Missing Number
- Hbase shell <一>
- 在Fedora23中安装XMind7
- Python下的Mysql模块MySQLdb安装详解
- bzoj 2743: [HEOI2012]采花 树状数组
- Cfile关于打开文件的操作
- Android studio下载依赖时提示连接超时time out的解决方法
- Fedora 使用
- 网络营销分类小说
- 哪些网站适合用于充电、学习新知识
- ACM刷题之HDU————找新朋友
- while循环
- MNIST数据集规则化
- 数据结构实验之排序三:bucket sort