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. What is going wrong here?? file appending problem

What is going wrong here?? file appending problem

Scheduled Pinned Locked Moved C / C++ / MFC
questionioshelp
2 Posts 1 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.
  • L Offline
    L Offline
    ldsdbomber
    wrote on last edited by
    #1

    THIS WORKS file is appended with the text "###, 28/06/07, 09:30, 1.736, 1.234" Message Box correctly reports fileName as expected. fstream FileDataStream; // Read Data FileDataStream.open(fileName, ios::out | ios::app); // Append Data FileDataStream<<"###,"; FileDataStream<<(LPCSTR)dateString<<','<<(LPCSTR)timeString<<','; sprintf(buf, "%.4f,", eTable[5*sel + 2]); // GeskeDose FileDataStream<

    L 1 Reply Last reply
    0
    • L ldsdbomber

      THIS WORKS file is appended with the text "###, 28/06/07, 09:30, 1.736, 1.234" Message Box correctly reports fileName as expected. fstream FileDataStream; // Read Data FileDataStream.open(fileName, ios::out | ios::app); // Append Data FileDataStream<<"###,"; FileDataStream<<(LPCSTR)dateString<<','<<(LPCSTR)timeString<<','; sprintf(buf, "%.4f,", eTable[5*sel + 2]); // GeskeDose FileDataStream<

      L Offline
      L Offline
      ldsdbomber
      wrote on last edited by
      #2

      Looks like I needed to call FileDataStream.clear(); I think that some error flag is set when the while loop pulls in the EOF marker while reading the file, and that is what causes the problem when you next try to open it.

      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