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. Storing data in a file with seperators

Storing data in a file with seperators

Scheduled Pinned Locked Moved C / C++ / MFC
c++question
5 Posts 5 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.
  • Q Offline
    Q Offline
    Quakey
    wrote on last edited by
    #1

    Hi, I have a program that needs to saves a lot of different data into a file. What I did was to put a seperator inbetween data and I used the character ^E (ASCII code 5) as the seperator. I later found out that it is fine if the data is all in English alphabets. However, other non-English languages actually uses ASCII code 5 as a readable/writable character. So if the data itself happens to have code 5 in it, my program mistakens it as a seperator and everything goes wrong. So what I would like to know is what are the better ways organize data in a file (besides using a character as a sepeartor). And if I had to use the separator scheme, what are the best ASCII characters to use as separators? I also don't want to use MFC's CFile and CArchive to write data. Thank you very much!

    N J D 3 Replies Last reply
    0
    • Q Quakey

      Hi, I have a program that needs to saves a lot of different data into a file. What I did was to put a seperator inbetween data and I used the character ^E (ASCII code 5) as the seperator. I later found out that it is fine if the data is all in English alphabets. However, other non-English languages actually uses ASCII code 5 as a readable/writable character. So if the data itself happens to have code 5 in it, my program mistakens it as a seperator and everything goes wrong. So what I would like to know is what are the better ways organize data in a file (besides using a character as a sepeartor). And if I had to use the separator scheme, what are the best ASCII characters to use as separators? I also don't want to use MFC's CFile and CArchive to write data. Thank you very much!

      N Offline
      N Offline
      Neville Franks
      wrote on last edited by
      #2

      Tab and comma are the most common separators. Ascii characters below 0x20 are control characters, so I have trouble imagining a language which uses Ascii 5 as a character. What language is this? Neville Franks, Author of ED for Windows. www.getsoft.com Make money with our new Affilate program

      1 Reply Last reply
      0
      • Q Quakey

        Hi, I have a program that needs to saves a lot of different data into a file. What I did was to put a seperator inbetween data and I used the character ^E (ASCII code 5) as the seperator. I later found out that it is fine if the data is all in English alphabets. However, other non-English languages actually uses ASCII code 5 as a readable/writable character. So if the data itself happens to have code 5 in it, my program mistakens it as a seperator and everything goes wrong. So what I would like to know is what are the better ways organize data in a file (besides using a character as a sepeartor). And if I had to use the separator scheme, what are the best ASCII characters to use as separators? I also don't want to use MFC's CFile and CArchive to write data. Thank you very much!

        J Offline
        J Offline
        jhaga
        wrote on last edited by
        #3

        Use fixed length data if you can, then you don't need any separator. Or use the same delimiters as Excel(or Access) uses. Test by selecting save as,Save as type, and select some standard type. jhaga CodeProject House, Paul Watson wrote: ...and the roar of John Simmons own personal Nascar in the garage. Meg flitting about taking photos.Chris having an heated arguement with Colin Davies and .S.Rod. over egian values. Nish manically typing *censur*. Duncan racing around after his pet *c.* Michael Martin and Bryce loudly yelling *c.* C.G. having a fit as Roger Wright loads up *c.* . Anna waving her *c.* and Deb scoffing chocolates in the corner. ...Good heavens!

        1 Reply Last reply
        0
        • Q Quakey

          Hi, I have a program that needs to saves a lot of different data into a file. What I did was to put a seperator inbetween data and I used the character ^E (ASCII code 5) as the seperator. I later found out that it is fine if the data is all in English alphabets. However, other non-English languages actually uses ASCII code 5 as a readable/writable character. So if the data itself happens to have code 5 in it, my program mistakens it as a seperator and everything goes wrong. So what I would like to know is what are the better ways organize data in a file (besides using a character as a sepeartor). And if I had to use the separator scheme, what are the best ASCII characters to use as separators? I also don't want to use MFC's CFile and CArchive to write data. Thank you very much!

          D Offline
          D Offline
          David Crow
          wrote on last edited by
          #4

          Use XML and you'll be fine.

          L 1 Reply Last reply
          0
          • D David Crow

            Use XML and you'll be fine.

            L Offline
            L Offline
            lob
            wrote on last edited by
            #5

            I store data with separator '\t' ( TAB ) and i'm satisfied :)

            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