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. Which method of CFile write a new line in text file ?

Which method of CFile write a new line in text file ?

Scheduled Pinned Locked Moved C / C++ / MFC
question
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.
  • L Offline
    L Offline
    Lost User
    wrote on last edited by
    #1

    :confused:

    L B 2 Replies Last reply
    0
    • L Lost User

      :confused:

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

      Miri try the following, you need to add Carriage Return and Line Feed characters to the end of the string to get it to create the file in DOS format and not Unix.

      CString strMsg = "Line 1\r\nLine 2\r\n";
      CFile OutFile;
      OutFile.Write(strMsg, strMsg.GetLength());

      Michael Martin Pegasystems Pty Ltd Australia martm@pegasystems.com +61 413-004-018

      1 Reply Last reply
      0
      • L Lost User

        :confused:

        B Offline
        B Offline
        Bob Groves
        wrote on last edited by
        #3

        Could you use CStdioFile instead, that has a WriteString method.

        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