Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: Problem with file i/o

Author: James Swafford

Date: 22:15:51 05/08/99

Go up one level in this thread


On May 08, 1999 at 20:56:52, James Robertson wrote:

>On May 08, 1999 at 17:42:57, James Swafford wrote:
>
>>On May 08, 1999 at 15:11:01, James Robertson wrote:
>>
>>>I have several questions about files in MSVC: how do I delete files? Also, is
>>>there a convenient way to tell a file's size with ifstream/ofstream? I have been
>>>doing this:
>>>
>>>ifstream in;
>>>in.open(file_path);
>>>in.seekg(0, ios::end);
>>>int size = in.tellg();
>>>
>>>But, this seems really nasty. Is there a better way?
>>>
>>>James
>>
>>
>>To delete a file, just use the 'remove' command:
>>
>>remove("file.ext");
>>
>>I'm not sure how to tell a file's size...
>
>Thanks anyway! At least now I don't have to manually delete all the garbage temp
>files from my program's new bookmaking formula. :)
>
>James
>
>>
>>--
>>James

That's exactly what prompted me to look it up. :-)
My older program would add moves from PGN games by first
looking in the book file, then adding an entry to a temp
file if there wasn't an entry in the book file.  Once
all the PGN files were processed, the temp file and the
'old' book file were merged into an updated book file.

Worked great until a lot of entries accumulated
in the temp file.  It was searched sequentially,
so it didn't take long to bog things down.  Ughh.. =)

Wouldn't want to go through all that again.

--
James




This page took 0 seconds to execute

Last modified: Thu, 15 Apr 21 08:11:13 -0700

Current Computer Chess Club Forums at Talkchess. This site by Sean Mintz.