How to Parse a CSV formatted text file in C programming

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • sabeen
    New Member
    • Aug 2012
    • 2

    How to Parse a CSV formatted text file in C programming

    my data are
    #saben~123~tvm~ 999999~local~#
    #ach~123~tvm~99 9999~body~#
    #sam~123~tvm~99 9999~wash~#
    #sus~123~tvm~99 9999~area~#
    #sach~123~tvm~9 99999~local~#
  • Frinavale
    Recognized Expert Expert
    • Oct 2006
    • 9749

    #2
    "CSV" stands for "comma separated values".
    The data that you have posted is not separated by commas.

    You should be able to split the strings into tokens on the "~" delimiter using the strtok method.

    -Frinny

    Comment

    • sabeen
      New Member
      • Aug 2012
      • 2

      #3
      my data are
      saben,121,tvm,9 99999,local
      ach,122,tvm,999 999,body
      saben,123,tvm,9 99999,local
      ach,124,tvm,999 999,body
      saben,125,tvm,9 99999,local
      ach,126,tvm,999 999,body


      how to slove them

      Comment

      • Frinavale
        Recognized Expert Expert
        • Oct 2006
        • 9749

        #4
        Same concept except split/tokenize the string on the "," delimiter.

        Comment

        Working...