Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. ATL / WTL / STL
  4. windows c++ fstream log file rollover

windows c++ fstream log file rollover

Scheduled Pinned Locked Moved ATL / WTL / STL
c++visual-studiohelp
3 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    Alan Kurlansky
    wrote on last edited by
    #1

    In my current VS C++ app I create an fstream log file for output and all works fine. It's initialized in the constructor declaration. Now I want to close it and start a new one upon the log file reaching a size limit. I've tried a number of things with no success. One approach was to not initialize in the constructor and use .open. That didn't work. Another was to go back to initialize in the constructor, then close, and rename, and open again. That didn't work either. Either I am missing some key point here or just doing some samll thing incorrectly. Any help would be appreciated. Thanks

    L 1 Reply Last reply
    0
    • A Alan Kurlansky

      In my current VS C++ app I create an fstream log file for output and all works fine. It's initialized in the constructor declaration. Now I want to close it and start a new one upon the log file reaching a size limit. I've tried a number of things with no success. One approach was to not initialize in the constructor and use .open. That didn't work. Another was to go back to initialize in the constructor, then close, and rename, and open again. That didn't work either. Either I am missing some key point here or just doing some samll thing incorrectly. Any help would be appreciated. Thanks

      L Offline
      L Offline
      Lost User
      wrote on last edited by
      #2

      Alan Kurlansky wrote:

      That didn't work.

      This sort of statement is really not very helpful; nobody can guess why it did not work. Explain exactly what you did and what results you got, if there is a short code snippet that helps with the explanation then include that as well. And don't forget to put code between <pre></pre> tags.

      Just say 'NO' to evaluated arguments for diadic functions! Ash

      A 1 Reply Last reply
      0
      • L Lost User

        Alan Kurlansky wrote:

        That didn't work.

        This sort of statement is really not very helpful; nobody can guess why it did not work. Explain exactly what you did and what results you got, if there is a short code snippet that helps with the explanation then include that as well. And don't forget to put code between <pre></pre> tags.

        Just say 'NO' to evaluated arguments for diadic functions! Ash

        A Offline
        A Offline
        Alan Kurlansky
        wrote on last edited by
        #3

        Sorry about that. But I was able to get things to work by reducing the scope of the file management. Now I am opening, closing, renaming the file all from within a function, using all local and local static variables.

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups