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. ofstream adding in start of file

ofstream adding in start of file

Scheduled Pinned Locked Moved ATL / WTL / STL
tutorialquestion
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.
  • S Offline
    S Offline
    SimpleProgramer
    wrote on last edited by
    #1

    I wish to add single string to the start of a file. I used: _file.seekp(0); // move to start of file _file << something << std::end; It overrides the text in start of file, but I wish to insert before current text. Does anyone know how to do it? THANKS! Keep it simple

    C 1 Reply Last reply
    0
    • S SimpleProgramer

      I wish to add single string to the start of a file. I used: _file.seekp(0); // move to start of file _file << something << std::end; It overrides the text in start of file, but I wish to insert before current text. Does anyone know how to do it? THANKS! Keep it simple

      C Offline
      C Offline
      CP Visitor
      wrote on last edited by
      #2

      SimpleProgramer wrote: I wish to add single string to the start of a file. I used: _file.seekp(0); // move to start of file _file << something << std::end; It overrides the text in start of file, but I wish to insert before current text. Does anyone know how to do it? There is nothing before 0 (which is even a philosophical answer :suss: ). Hint: You can write a new file ....

      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