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. Serialize

Serialize

Scheduled Pinned Locked Moved C / C++ / MFC
data-structureshelpquestion
4 Posts 3 Posters 1 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
    Anthony9887
    wrote on last edited by
    #1

    I created a CStringArray to hold some text. Whenever I serialize the array, i noticed there are some garbage in the text file. How do I fix this. I want to write carriage returns and newlines. I'm using a CFile object. Thanks

    S 1 Reply Last reply
    0
    • A Anthony9887

      I created a CStringArray to hold some text. Whenever I serialize the array, i noticed there are some garbage in the text file. How do I fix this. I want to write carriage returns and newlines. I'm using a CFile object. Thanks

      S Offline
      S Offline
      Saqib Razzaq
      wrote on last edited by
      #2

      Whenever you want text to appear on new line in file, use "\r\n" in a char type array or CString. e.g. CString m_strLines; m_strLines = "Line1.\r\nLine2\r\n"; I am not clear about the garbage that appeared in the file. Does the garbage characters appear at the end of your data or your data is not saved at all?

      A 1 Reply Last reply
      0
      • S Saqib Razzaq

        Whenever you want text to appear on new line in file, use "\r\n" in a char type array or CString. e.g. CString m_strLines; m_strLines = "Line1.\r\nLine2\r\n"; I am not clear about the garbage that appeared in the file. Does the garbage characters appear at the end of your data or your data is not saved at all?

        A Offline
        A Offline
        Anthony9887
        wrote on last edited by
        #3

        Hi, I have no problems with the carriage and line feeds. I have garbage character in from of all the text strings. ie Text1 Text2

        B 1 Reply Last reply
        0
        • A Anthony9887

          Hi, I have no problems with the carriage and line feeds. I have garbage character in from of all the text strings. ie Text1 Text2

          B Offline
          B Offline
          basementman
          wrote on last edited by
          #4

          This is the class info from Serialize. The Serialize method stores the object info in a binary format, not a text format. If you want to "serialize" your stringarray as a text file, you need to do this manually.  onwards and upwards...

          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