Click here to Skip to main content
13,000,469 members (66,401 online)
Click here to Skip to main content
Add your own
alternative version


13 bookmarked
Posted 5 Feb 2001

Circular File

, 5 Feb 2001
Rate this:
Please Sign up or sign in to vote.
A class that implements a simple circular file.
<!-- Download Links -->
  • Download source files - 28 Kb
  • <!-- Main HTML starts here -->


    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. 


    • CCirFile() - Creates a new file with name "default Log" with 100 Lines
    • CCirFile(char * strFileName) - Creates a file with name strFileName. strFileName must be less than 100 lines
    • CCirFile(char * ,int ) - You can specify the file name and file size


    • int InitFile() - All file initialization is done here
    • int AddLine( CString ) - You should call this function to a add new line at the start of the file


    1. 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
    2. It's slow. It can be enhanced by using multithreading.


    This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

    A list of licenses authors might use can be found here


    About the Author

    Ibrar Ahmad
    Web Developer
    Pakistan Pakistan
    Master of Computer Science
    1). C++
    2). C
    3). Network Programming...
    Socket,Pipe,Protocol Implemntation
    4). hardware interfaceing
    5). Emabeded programming in C51...Etc
    (for 8051,PIC,C166 Processores)

    You may also be interested in...

    Comments and Discussions

    GeneralMy vote of 1 Pin
    MichaelSimons26-Nov-08 5:52
    memberMichaelSimons26-Nov-08 5:52 

    General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

    Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

    Permalink | Advertise | Privacy | Terms of Use | Mobile
    Web02 | 2.8.170624.1 | Last Updated 6 Feb 2001
    Article Copyright 2001 by Ibrar Ahmad
    Everything else Copyright © CodeProject, 1999-2017
    Layout: fixed | fluid