Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.c > #112371
| From | DFS <nospam@dfs.com> |
|---|---|
| Newsgroups | comp.lang.c |
| Subject | Re: Splitting strings into arrays with sscanf |
| Date | 2017-06-16 15:36 -0400 |
| Organization | A noiseless patient Spider |
| Message-ID | <oi1bko$79b$5@dont-email.me> (permalink) |
| References | <oi14f9$edg$3@dont-email.me> <7c12a92a-5cf7-cb57-2937-a689345687bc@verizon.net> |
On 6/16/2017 2:22 PM, James R. Kuyper wrote: > This is an alternate response, taking the above code at face value. I > suspect that in your actual code, the labels and the data might not be > known at compile time, or might change during the running of your > program. Yep. It's input from a .csv file (1st row is labels). I'm now thinking of 2 approaches, one with sscanf and one without: * with sscanf: replace the commas with spaces and use sscanf the way you indicated. sscanf(line,"%s %s %s %s",...) Dealing with quote-delimited data will be fun. DFS,Q1,shirts,100 "J Kuyper",Q1,shoes,200 * without sscanf: 'brute-force' read each character and parse data between commas. Thanks for your help.
Back to comp.lang.c | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Splitting strings into arrays with sscanf DFS <nospam@dfs.com> - 2017-06-16 13:33 -0400
Re: Splitting strings into arrays with sscanf scott@slp53.sl.home (Scott Lurndal) - 2017-06-16 17:46 +0000
Re: Splitting strings into arrays with sscanf DFS <nospam@dfs.com> - 2017-06-16 14:02 -0400
Re: Splitting strings into arrays with sscanf scott@slp53.sl.home (Scott Lurndal) - 2017-06-16 18:15 +0000
Re: Splitting strings into arrays with sscanf Keith Thompson <kst-u@mib.org> - 2017-06-16 12:28 -0700
Re: Splitting strings into arrays with sscanf Keith Thompson <kst-u@mib.org> - 2017-06-16 12:20 -0700
Re: Splitting strings into arrays with sscanf Lew Pitcher <lew.pitcher@digitalfreehold.ca> - 2017-06-16 13:47 -0400
Re: Splitting strings into arrays with sscanf scott@slp53.sl.home (Scott Lurndal) - 2017-06-16 18:01 +0000
Re: Splitting strings into arrays with sscanf Barry Schwarz <schwarzb@dqel.com> - 2017-06-16 12:03 -0700
Re: Splitting strings into arrays with sscanf "James R. Kuyper" <jameskuyper@verizon.net> - 2017-06-16 15:33 -0400
Re: Splitting strings into arrays with sscanf Keith Thompson <kst-u@mib.org> - 2017-06-16 13:16 -0700
Re: Splitting strings into arrays with sscanf Keith Thompson <kst-u@mib.org> - 2017-06-16 12:31 -0700
Re: Splitting strings into arrays with sscanf "James R. Kuyper" <jameskuyper@verizon.net> - 2017-06-16 15:45 -0400
Re: Splitting strings into arrays with sscanf "James R. Kuyper" <jameskuyper@verizon.net> - 2017-06-16 14:07 -0400
Re: Splitting strings into arrays with sscanf "James R. Kuyper" <jameskuyper@verizon.net> - 2017-06-16 14:22 -0400
Re: Splitting strings into arrays with sscanf DFS <nospam@dfs.com> - 2017-06-16 15:36 -0400
Re: Splitting strings into arrays with sscanf "James R. Kuyper" <jameskuyper@verizon.net> - 2017-06-16 17:17 -0400
Re: Splitting strings into arrays with sscanf Barry Schwarz <schwarzb@dqel.com> - 2017-06-16 12:06 -0700
Re: Splitting strings into arrays with sscanf Real Troll <Real.Troll@Trolls.com> - 2017-06-16 17:30 -0400
Re: Splitting strings into arrays with sscanf ike@iceland.freeshell.org - 2017-06-17 16:49 +0000
Re: Splitting strings into arrays with sscanf Richard Damon <Richard@Damon-Family.org> - 2017-06-17 18:25 -0400
csiph-web