Circular File






3.13/5 (4 votes)
Feb 6, 2001

53600

720
A class that implements a simple circular file.
Introduction
When I wrote my first article on codeguru "Expandable Buffer" I saw there were lot of people seeking a Circular File. Hence I developed my own Circular File, and wanted to share it. Its interface is so simple.
Constructors
CCirFile()
- Creates a new file with name "default Log" with 100 LinesCCirFile(char * strFileName)
- Creates a file with name strFileName. strFileName must be less than 100 linesCCirFile(char * ,int )
- You can specify the file name and file size
Methods
int InitFile()
- All file initialization is done hereint AddLine( CString )
- You should call this function to a add new line at the start of the file
Limitations
- Its not a true Circular File. It will add a new line at the start of the file and move all lines down one place, and the last line will removed
- It's slow. It can be enhanced by using multithreading.