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. C / C++ / MFC
  4. hard disk full while writing to file

hard disk full while writing to file

Scheduled Pinned Locked Moved C / C++ / MFC
questionperformancehelpcareer
2 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.
  • J Offline
    J Offline
    Jake Palmer
    wrote on last edited by
    #1

    I'm writing some data to a CStdioFile in a loop, and my program gets through the loop but gives me an error when I close the dialog, saying "hard disk full while writing to file". The file is blank. I know the hard disk is not ACTUALLY full, so is this caused by a memory leak somewhere in my code? A possible cause would be a loop where I read from a file: CPerson *p; while (...) { CString name = (read a name from a file) p = new Person(name); //should this next line do the job? delete (p); } I'm not a memory freeing guru, so I'm definitely causing some trouble here :laugh: How can I get this file written? thanks, Jake

    J 1 Reply Last reply
    0
    • J Jake Palmer

      I'm writing some data to a CStdioFile in a loop, and my program gets through the loop but gives me an error when I close the dialog, saying "hard disk full while writing to file". The file is blank. I know the hard disk is not ACTUALLY full, so is this caused by a memory leak somewhere in my code? A possible cause would be a loop where I read from a file: CPerson *p; while (...) { CString name = (read a name from a file) p = new Person(name); //should this next line do the job? delete (p); } I'm not a memory freeing guru, so I'm definitely causing some trouble here :laugh: How can I get this file written? thanks, Jake

      J Offline
      J Offline
      Jonathon Lockett
      wrote on last edited by
      #2

      The delete line is definately what you need to free the memory before calling new again, otherwise you'll leak memory for sure. As an aside, it probably dosn't matter directly in this case, but it is *always* a good idea to set pointers you've called delete on to NULL. Jonathon

      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