Click here to Skip to main content
11,932,103 members (62,902 online)
Rate this:
Please Sign up or sign in to vote.
See more: MFC

Please let me know,how can I remove each lines in the file using CFile class.

Posted 16-Aug-12 9:31am
Wes Aday 16-Aug-12 14:37pm
Read lines and if you do not want them, don't write them back out.
Kenneth Haugland 16-Aug-12 15:05pm
Im having a hard time to decide if its a text line or a real line in a drawing program, still wondering ;)
Rate this: bad
Please Sign up or sign in to vote.

Solution 1

Modifying CFileFinder - Extend the functionality of CFileFind MFC class[^] should be fairly straight forward.

Best regards
Espen Harlinn
Abhinav S 16-Aug-12 23:22pm
My 5.
Espen Harlinn 17-Aug-12 4:12am
Thank you, Abhinav :-D
AlluvialDeposit 17-Aug-12 3:08am
Espen Harlinn 17-Aug-12 4:13am
Thank you, AlluvialDeposit :-D
Rate this: bad
Please Sign up or sign in to vote.

Solution 2

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 :
write function is:
Richard MacCutchan 6-Sep-12 9:43am
Please use <pre> tags around code blocks for clarity (as I have done for you).

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Mobile
Web02 | 2.8.151126.1 | Last Updated 6 Sep 2012
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100