What happened to the Messenger Plus! forums on msghelp.net?
Shoutbox » MsgHelp Archive » Skype & Technology » Tech Talk » C++ Question (Clearing a File)

C++ Question (Clearing a File)
Author: Message:
Maniac
Senior Member
****

Avatar
Posts including T&T: 1684

Posts: 549
Reputation: 9
37 / Male / –
Joined: Apr 2004
O.P. Huh?  C++ Question (Clearing a File)
Alright, i'm in desperate help for a very simple problem...

I just finished a program that uses a file to keep track of records. One of the functions in my program loads each record from the file into a linked list and does all sorts of things to them. Long story short, once the function runs, i have a smaller version of the file in the linked list.

Now what i want to do is simple, take the stuff from the linked list and put them in the file... BUT how do i do that? :p

I thought of just going to the beginning of the file then sticking everything in, but considering this "new version" is shorter some of the previous stuff will remain at the end.

I then thought of going over the file and replacing everything with a blank space then added the new version at the beginning... it works... but i don't like the way i did it and its very unefficient...

So my question is... how can you clear a file? (If it is possible i don't mind deleting the file and creating another one with the same name... anything to get the file empty)

I'd appreciate your help... this damned thing is due tomorrow and i can't think anymore :'(
[Image: maniacsig0pb.jpg]
*It took Jesus 3 days to respawn! Talk about lag!* :rofl:
03-29-2005 11:36 PM
Profile E-Mail PM Web Find Quote Report
« Next Oldest Return to Top Next Newest »

Messages In This Thread
C++ Question (Clearing a File) - by Maniac on 03-29-2005 at 11:36 PM
RE: C++ Question (Clearing a File) - by Ash_ on 03-30-2005 at 12:20 AM
RE: C++ Question (Clearing a File) - by Maniac on 03-30-2005 at 12:28 AM
RE: C++ Question (Clearing a File) - by segosa on 03-30-2005 at 05:31 AM


Threaded Mode | Linear Mode
View a Printable Version
Send this Thread to a Friend
Subscribe | Add to Favorites
Rate This Thread:

Forum Jump:

Forum Rules:
You cannot post new threads
You cannot post replies
You cannot post attachments
You can edit your posts
HTML is Off
myCode is On
Smilies are On
[img] Code is On