sscanf: parsing a file
-
I need to to talk to all slaves of that lang :))
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] -
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]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
-
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
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] -
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] -
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]thanks my optimistic philospher. you work full time on this board and are getting paid for the shit u speak.
-
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] -
thanks my optimistic philospher. you work full time on this board and are getting paid for the shit u speak.
-
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'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).
-
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?
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, whilesscanf()
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
-
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] -
I need to to talk to all slaves of that lang :))
-
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
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.
-
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).
I love you, man (expecially with the warrior outfit). :)
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] -
I love you, man (expecially with the warrior outfit). :)
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]CPallini wrote:
expecially with the warrior outfit
Since he moved to Sweden, does that involve a big helmet with horns? :laugh: And yes, I know the Vikings didn't actually wear those but they're cool anyhow. :cool:
You measure democracy by the freedom it gives its dissidents, not the freedom it gives its assimilated conformists.
-
CPallini wrote:
expecially with the warrior outfit
Since he moved to Sweden, does that involve a big helmet with horns? :laugh: And yes, I know the Vikings didn't actually wear those but they're cool anyhow. :cool:
You measure democracy by the freedom it gives its dissidents, not the freedom it gives its assimilated conformists.
I think you missed something [^]... :-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] -
I think you missed something [^]... :-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]Guess so! :doh: I don't usually check the profiles of people I'm familiar with. Guess we'd better send the word out that a raiding party is on the way. :laugh:
You measure democracy by the freedom it gives its dissidents, not the freedom it gives its assimilated conformists.