菜鸟求助贴!如何用win32编程方式将获取的字符串保存到txt文件中以及如何打开txt文件获取字符串

hit1106 2015-06-06 08:55:25
如何用win32编程方式将获取的字符串保存到txt文件中以及如何打开txt文件获取字符串
...全文
323 9 打赏 收藏 转发到动态 举报
写回复
用AI写文章
9 条回复
切换为时间正序
请发表友善的回复…
发表回复
hit1106 2015-06-10
  • 打赏
  • 举报
回复
结贴了,我最后用win32 GetOpenFileName函数搞定了
hit1106 2015-06-09
  • 打赏
  • 举报
回复
引用 6 楼 zhao4zhong1 的回复:
CFile Class Members Data Members m_hFile Usually contains the operating-system file handle. Construction CFile Constructs a CFile object from a path or file handle. Abort Closes a file ignoring all warnings and errors. Duplicate Constructs a duplicate object based on this file. Open Safely opens a file with an error-testing option. Close Closes a file and deletes the object. Input/Output Read Reads (unbuffered) data from a file at the current file position. ReadHuge Can read more than 64K of (unbuffered) data from a file at the current file position. Obsolete in 32-bit programming. See Read. Write Writes (unbuffered) data in a file to the current file position. WriteHuge Can write more than 64K of (unbuffered) data in a file to the current file position. Obsolete in 32-bit programming. See Write. Flush Flushes any data yet to be written. Position Seek Positions the current file pointer. SeekToBegin Positions the current file pointer at the beginning of the file. SeekToEnd Positions the current file pointer at the end of the file. GetLength Retrieves the length of the file. SetLength Changes the length of the file. Locking LockRange Locks a range of bytes in a file. UnlockRange Unlocks a range of bytes in a file. Status GetPosition Retrieves the current file pointer. GetStatus Retrieves the status of this open file. GetFileName Retrieves the filename of the selected file. GetFileTitle Retrieves the title of the selected file. GetFilePath Retrieves the full file path of the selected file. SetFilePath Sets the full file path of the selected file. Static Rename Renames the specified file (static function). Remove Deletes the specified file (static function). GetStatus Retrieves the status of the specified file (static, virtual function). SetStatus Sets the status of the specified file (static, virtual function). CFile Overview | Base Class Members | Hierarchy Chart
赵老师,我通过已有的CH367mAccessBlock()获取UCHAR 类型的buffer[],现在想把该字符串写到txt文件中,怎么实现呢?能给一些代码吗?谢谢啦
hit1106 2015-06-09
  • 打赏
  • 举报
回复
引用 5 楼 adanliutao 的回复:
io输入输出流 #include<stdafx.h> #include<fstream> #include<iostream> #include<cstdlib> void g() { char ch; ifstream infile("c:\\users\\adan\\desktop\\abc.txt", ios::in);//进入到指定文件 ofstream outfile("c:\\users\\adan\\desktop\\abc2.txt");//创建文件 while (infile.get(ch)) { outfile.put(ch); //将从abc.txt抓取的信息输入abc2.txt中 } cout << endl; infile.close(); outfile.close(); } ,,,,,,,
我是用的win32的方式,能给一个win32 方式的方法吗?谢谢啦
赵4老师 2015-06-07
  • 打赏
  • 举报
回复
CFile Class Members Data Members m_hFile Usually contains the operating-system file handle. Construction CFile Constructs a CFile object from a path or file handle. Abort Closes a file ignoring all warnings and errors. Duplicate Constructs a duplicate object based on this file. Open Safely opens a file with an error-testing option. Close Closes a file and deletes the object. Input/Output Read Reads (unbuffered) data from a file at the current file position. ReadHuge Can read more than 64K of (unbuffered) data from a file at the current file position. Obsolete in 32-bit programming. See Read. Write Writes (unbuffered) data in a file to the current file position. WriteHuge Can write more than 64K of (unbuffered) data in a file to the current file position. Obsolete in 32-bit programming. See Write. Flush Flushes any data yet to be written. Position Seek Positions the current file pointer. SeekToBegin Positions the current file pointer at the beginning of the file. SeekToEnd Positions the current file pointer at the end of the file. GetLength Retrieves the length of the file. SetLength Changes the length of the file. Locking LockRange Locks a range of bytes in a file. UnlockRange Unlocks a range of bytes in a file. Status GetPosition Retrieves the current file pointer. GetStatus Retrieves the status of this open file. GetFileName Retrieves the filename of the selected file. GetFileTitle Retrieves the title of the selected file. GetFilePath Retrieves the full file path of the selected file. SetFilePath Sets the full file path of the selected file. Static Rename Renames the specified file (static function). Remove Deletes the specified file (static function). GetStatus Retrieves the status of the specified file (static, virtual function). SetStatus Sets the status of the specified file (static, virtual function). CFile Overview | Base Class Members | Hierarchy Chart
hit1106 2015-06-06
  • 打赏
  • 举报
回复
@zhao4zhong1
hit1106 2015-06-06
  • 打赏
  • 举报
回复
希望能添加两个控件按钮,一个是保存获取的字符串到txt,并选择要存储的位置的按钮;一个是打开txt文件的位置,获取所选中的txt的内容
adanliutao 2015-06-06
  • 打赏
  • 举报
回复
io输入输出流 #include<stdafx.h> #include<fstream> #include<iostream> #include<cstdlib> void g() { char ch; ifstream infile("c:\\users\\adan\\desktop\\abc.txt", ios::in);//进入到指定文件 ofstream outfile("c:\\users\\adan\\desktop\\abc2.txt");//创建文件 while (infile.get(ch)) { outfile.put(ch); //将从abc.txt抓取的信息输入abc2.txt中 } cout << endl; infile.close(); outfile.close(); } ,,,,,,,
hit1106 2015-06-06
  • 打赏
  • 举报
回复
引用 3 楼 FightForProgrammer 的回复:
http://blog.csdn.net/brantyou/article/details/7070556
请问,我想在已有的界面上添加IDC_MEMWR和IDC_MEMRD这两个按钮,怎么添加?

69,382

社区成员

发帖
与我相关
我的任务
社区描述
C语言相关问题讨论
社区管理员
  • C语言
  • 花神庙码农
  • 架构师李肯
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧