如何在MFC中使用CFile类删除行 [英] How to Remove a Line Using CFile class in MFC
本文介绍了如何在MFC中使用CFile类删除行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
请让我知道,如何使用CFile类删除文件中的每一行.
-Abhi
Hi,
Please let me know,how can I remove each lines in the file using CFile class.
-Abhi
推荐答案
修改 ^ ]应该相当简单.
最好的问候
Espen Harlinn
Modifying CFileFinder - Extend the functionality of CFileFind MFC class[^] should be fairly straight forward.
Best regards
Espen Harlinn
您想要什么?
删除文件或行中的某些文本?
如果您是指一条线,那就去做吧:
循环编写各行,直到到达为止.
然后读那行但不要写.
之后,在循环中写余数行.
what do you want?
remove a certain text in file or a line?
if you mean a line, do it :
in a loop write lines until you arrive to that.
then read that line but don''t write.
after that in a loop write remainder lines.
CFile f;
f.Open(_T("path of the file"),CFile::modeRead|CFile::modeWrite);
read function is :
f.Read(buffer,count);
write function is:
f.Write(buffer,count);
f.Close();
这篇关于如何在MFC中使用CFile类删除行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文