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. sscanf: parsing a file

sscanf: parsing a file

Scheduled Pinned Locked Moved C / C++ / MFC
questionregexjson
40 Posts 8 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.
  • T tom groezer

    :) but it is helping you AH.

    CPalliniC Offline
    CPalliniC Offline
    CPallini
    wrote on last edited by
    #17

    tom groezer wrote:

    but it is helping you AH

    I'm glad to be a representative of the Austro-Hungarian empire. As about you, well, hiding behind acronyms or Hindi language makes you just a coward, a plain, silly, dumb coward. :)

    If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
    This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
    [My articles]

    In testa che avete, signor di Ceprano?

    1 Reply Last reply
    0
    • CPalliniC CPallini

      Thank you. :)

      If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
      This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
      [My articles]

      T Offline
      T Offline
      tom groezer
      wrote on last edited by
      #18

      I think you guys are all slaves of that palini the ASHO. I can see the forum for his developement skills. Looks like he is a frsutrated devloper in and needs some moksha. Let me know if you need that :)

      T 1 Reply Last reply
      0
      • T tom groezer

        I think you guys are all slaves of that palini the ASHO. I can see the forum for his developement skills. Looks like he is a frsutrated devloper in and needs some moksha. Let me know if you need that :)

        T Offline
        T Offline
        tom groezer
        wrote on last edited by
        #19

        Ganje (Read bald in your mother tongue :)) aadmi ka aise hee haal hota hein

        CPalliniC 1 Reply Last reply
        0
        • T tom groezer

          Ganje (Read bald in your mother tongue :)) aadmi ka aise hee haal hota hein

          CPalliniC Offline
          CPalliniC Offline
          CPallini
          wrote on last edited by
          #20

          tom groezer wrote:

          Ganje (Read bald in your mother tongue Smile ) aadmi ka aise hee haal hota hein

          Of course you missed my mother tongue. I see you have a brilliant brain. :rolleyes:

          If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
          This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
          [My articles]

          In testa che avete, signor di Ceprano?

          L 1 Reply Last reply
          0
          • CPalliniC CPallini

            tom groezer wrote:

            Ganje (Read bald in your mother tongue Smile ) aadmi ka aise hee haal hota hein

            Of course you missed my mother tongue. I see you have a brilliant brain. :rolleyes:

            If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
            This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
            [My articles]

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

            CPallini wrote:

            Of course you missed my mother tongue.

            Take it as a compliment. Hell, your English is probably better than mine. :laugh:

            L u n a t i c F r i n g e

            CPalliniC 1 Reply Last reply
            0
            • L Lost User

              CPallini wrote:

              Of course you missed my mother tongue.

              Take it as a compliment. Hell, your English is probably better than mine. :laugh:

              L u n a t i c F r i n g e

              CPalliniC Offline
              CPalliniC Offline
              CPallini
              wrote on last edited by
              #22

              LunaticFringe wrote:

              Take it as a compliment.

              Good point.

              LunaticFringe wrote:

              Hell, your English is probably better than mine.

              Nah, my English is actually bad. Anyway now it is a bit better, thanks to all the people mocking me when I started to post in the Lounge, few years ago. :-D

              If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
              This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
              [My articles]

              In testa che avete, signor di Ceprano?

              T L 3 Replies Last reply
              0
              • CPalliniC CPallini

                LunaticFringe wrote:

                Take it as a compliment.

                Good point.

                LunaticFringe wrote:

                Hell, your English is probably better than mine.

                Nah, my English is actually bad. Anyway now it is a bit better, thanks to all the people mocking me when I started to post in the Lounge, few years ago. :-D

                If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
                This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
                [My articles]

                T Offline
                T Offline
                tom groezer
                wrote on last edited by
                #23

                I need to to talk to all slaves of that lang :))

                CPalliniC T 2 Replies Last reply
                0
                • CPalliniC CPallini

                  LunaticFringe wrote:

                  Take it as a compliment.

                  Good point.

                  LunaticFringe wrote:

                  Hell, your English is probably better than mine.

                  Nah, my English is actually bad. Anyway now it is a bit better, thanks to all the people mocking me when I started to post in the Lounge, few years ago. :-D

                  If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
                  This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
                  [My articles]

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

                  CPallini wrote:

                  Anyway now it is a bit better, thanks to all the people mocking me when I started to post in the Lounge, few years ago.

                  Well, hey, I'll have to make sure and tease you if I see anything amiss. Wouldn't want you thinking I wasn't doing my part, ya know. :laugh:

                  L u n a t i c F r i n g e

                  1 Reply Last reply
                  0
                  • T tom groezer

                    I need to to talk to all slaves of that lang :))

                    CPalliniC Offline
                    CPalliniC Offline
                    CPallini
                    wrote on last edited by
                    #25

                    Yeah, I suppose it is a part of the troll's baggage. :)

                    If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
                    This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
                    [My articles]

                    In testa che avete, signor di Ceprano?

                    1 Reply Last reply
                    0
                    • CPalliniC CPallini

                      LunaticFringe wrote:

                      Take it as a compliment.

                      Good point.

                      LunaticFringe wrote:

                      Hell, your English is probably better than mine.

                      Nah, my English is actually bad. Anyway now it is a bit better, thanks to all the people mocking me when I started to post in the Lounge, few years ago. :-D

                      If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
                      This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
                      [My articles]

                      T Offline
                      T Offline
                      tom groezer
                      wrote on last edited by
                      #26

                      LunaticFringe wrote: Take it as a compliment. Good point. --->which one. you being a ganja LunaticFringe wrote: Hell, your English is probably better than mine. pallini Nah, my English is actually bad. Anyway now it is a bit better, thanks to all the people mocking me when I started to post in the Lounge, few years ago. Hope your attitute also shines like you head when people mock you in days to come :) Big Grin

                      CPalliniC 1 Reply Last reply
                      0
                      • T tom groezer

                        LunaticFringe wrote: Take it as a compliment. Good point. --->which one. you being a ganja LunaticFringe wrote: Hell, your English is probably better than mine. pallini Nah, my English is actually bad. Anyway now it is a bit better, thanks to all the people mocking me when I started to post in the Lounge, few years ago. Hope your attitute also shines like you head when people mock you in days to come :) Big Grin

                        CPalliniC Offline
                        CPalliniC Offline
                        CPallini
                        wrote on last edited by
                        #27

                        I hope your brilliant brain will eventually overcome the 'skip blanks and tabs' daunting trouble. :laugh:

                        If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
                        This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
                        [My articles]

                        In testa che avete, signor di Ceprano?

                        C J T 3 Replies Last reply
                        0
                        • CPalliniC CPallini

                          I hope your brilliant brain will eventually overcome the 'skip blanks and tabs' daunting trouble. :laugh:

                          If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
                          This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
                          [My articles]

                          C Offline
                          C Offline
                          Covean
                          wrote on last edited by
                          #28

                          Thanks (oh my master ;P ) this saved my day! :laugh:

                          Greetings Covean

                          1 Reply Last reply
                          0
                          • CPalliniC CPallini

                            I hope your brilliant brain will eventually overcome the 'skip blanks and tabs' daunting trouble. :laugh:

                            If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
                            This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
                            [My articles]

                            T Offline
                            T Offline
                            tom groezer
                            wrote on last edited by
                            #29

                            thanks my optimistic philospher. you work full time on this board and are getting paid for the shit u speak.

                            J 1 Reply Last reply
                            0
                            • CPalliniC CPallini

                              I hope your brilliant brain will eventually overcome the 'skip blanks and tabs' daunting trouble. :laugh:

                              If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
                              This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
                              [My articles]

                              J Offline
                              J Offline
                              jeron1
                              wrote on last edited by
                              #30

                              5! :thumbsup:

                              1 Reply Last reply
                              0
                              • T tom groezer

                                thanks my optimistic philospher. you work full time on this board and are getting paid for the shit u speak.

                                J Offline
                                J Offline
                                jeron1
                                wrote on last edited by
                                #31

                                If you spent half the time working on your problem than you do hurling insults, you probably would answered your own question hours ago.

                                1 Reply Last reply
                                0
                                • T tom groezer

                                  Hi, I need to parse a file which has spaces and tabs with some entries that i need to pull. I'm using sscanf function. How do I ensure that I skip the spaces and tabs which could be in randon number. What could be a regular expression for this?

                                  I Offline
                                  I Offline
                                  Iain Clarke Warrior Programmer
                                  wrote on last edited by
                                  #32

                                  I'm not quite sure what you've done to annoy CPallini... but he has my trust, so I assume you deserve the long flamewar above this post. But *I'm* in a good mood... I would not use the sscanf function at all for this. One, the tabs / spaces are delimiters. In which case, read a line of text in, then use your favourite string classes Find function to get the next whitespace. Then parse the next up to that point. Delete the text you've parsed, and repeat. OK, once you've broken the long line into stringlets, then you can use sscanf if you like! Good luck, Iain.

                                  I have now moved to Sweden for love (awwww).

                                  CPalliniC 1 Reply Last reply
                                  0
                                  • T tom groezer

                                    Hi, I need to parse a file which has spaces and tabs with some entries that i need to pull. I'm using sscanf function. How do I ensure that I skip the spaces and tabs which could be in randon number. What could be a regular expression for this?

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

                                    After your tirade to other professionals here, you surely do not deserve any help.

                                    tom groezer wrote:

                                    I need to parse a file... I'm using sscanf function.

                                    Which means you are using the wrong tool for the job. fscanf() would be used to parse the file, while sscanf() would be used to parse a string read from the file. There is a subtle but big difference. Learn that difference and you'll save yourself many bouts with foot-in-mouth disease.

                                    tom groezer wrote:

                                    How do I ensure that I skip the spaces and tabs which could be in randon number.

                                    Is it really that hard to find something like:

                                    char *str = "I really\tdo \t not deserve any\t help";
                                    char s1[8], s2[8], s3[8], s4[8], s5[8], s6[8], s7[8];
                                    sscanf(str, "%s %s %s %s %s %s %s", s1, s2, s3, s4, s5, s6, s7);

                                    "One man's wage rise is another man's price increase." - Harold Wilson

                                    "Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons

                                    "Man who follows car will be exhausted." - Confucius

                                    1 Reply Last reply
                                    0
                                    • CPalliniC CPallini

                                      tom groezer wrote:

                                      a******le. Parese the space in between

                                      I'm not able to skip the blanks and the tabs, please provide me code... :-\

                                      If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
                                      This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
                                      [My articles]

                                      T Offline
                                      T Offline
                                      Tim Craig
                                      wrote on last edited by
                                      #34

                                      Zing! :thumbsup:

                                      You measure democracy by the freedom it gives its dissidents, not the freedom it gives its assimilated conformists.

                                      1 Reply Last reply
                                      0
                                      • T tom groezer

                                        I need to to talk to all slaves of that lang :))

                                        T Offline
                                        T Offline
                                        Tim Craig
                                        wrote on last edited by
                                        #35

                                        If it wasn't for English, you Indians mostly couldn't talk to each other. :doh:

                                        You measure democracy by the freedom it gives its dissidents, not the freedom it gives its assimilated conformists.

                                        1 Reply Last reply
                                        0
                                        • T tom groezer

                                          I guess you are not a software developer but rather a philoshpher who thinks about those sentences. I need a urgent fix and dont want to travel googling. I guess the forum is to get answer and not to fight around and highjacking

                                          T Offline
                                          T Offline
                                          Tim Craig
                                          wrote on last edited by
                                          #36

                                          tom groezer wrote:

                                          I need a urgent fix and dont want to travel googling.

                                          It doesn't get much faster than Googling so get used to it. If you had a clue, you'd have had your answer before you could post here.

                                          You measure democracy by the freedom it gives its dissidents, not the freedom it gives its assimilated conformists.

                                          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