Deleting specific line from file

Hail and well met,

I've been busy with files lately and since I am fairly new to the concept of reading and writing files I was wondering if anyone could tell me how to delete a specific line from a file.

for example a txt file is filled with


aaaaaaaaaaaaaa
bbbbbbbbbbbbbb
ccccccccccccccccccc
dddddddddddddd

Now I would like to delete line cccccccccccccc so that I end up with

aaaaaaaaaaaaaa
bbbbbbbbbbbbbb
dddddddddddddd

so far I managed to use seek functions to determine the end and the beginning of the line and I can easily overwrite it with  blank spaces. But I don't want a blank line in my file and I furthermore don't want to read the entire file into a buffer and then write it back once I am done deleting (since my file is... big)

This is what I have so far (minus some redundant code):

while (fileLoader.ReadString(strLine)){
if (strLine == CurrentMess){ // currentmess is known
      FilePos = fileLoader.GetPosition(); // retrieve position
      FilePos -= FileOffset+2; // file offset is the length of currentmess
      fileLoader.Seek(FilePos, CFile::begin); // go to beginning of deletable line
      for (int index = 0; index != FileOffset;index++)
                      fileLoader.Write(" ",1); // overwrite with spaces
      fileLoader.Close();
}


never mind the syntax I deleted some junk from it probably causing it to not compile anymore.

Either way rather than just overwriting the line with blanks I'd rather remove the entire line (including \n)

Any ideas?

Thanks in advance,

Cap
LVL 1
CaptainIAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

r-kCommented:
There are probably some tricky ways of doing what you want, but I don't
think they would be better than just creating a new file, esp. if you want
your program to be system independent.
CaptainIAuthor Commented:
Yeah I have been poking around at it for a few hours now and I guess it is easier to make a new file. If anyone could give me a hint on how it would be done without creating a new file I'd appreciate it, now I just plain want to know hehe.

If someone manages to provide me with a decent indication I'll drop the 50 points on that person otherwise I'll just attempt to claim them back.

NetminderCommented:
PAQed, with points refunded (50)

Netminder
Site Admin

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
System Programming

From novice to tech pro — start learning today.