Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.c > #100196
| Message-Id | <s6g1jd-5t4.ln1@walter.foo> |
|---|---|
| From | "Peter \"Shaggy\" Haywood" <phaywood@alphalink.com.au> |
| Subject | Re: [Structure of Array] pointer arithmetic in structures |
| Newsgroups | comp.lang.c |
| Date | 2016-12-24 17:12 +1100 |
| References | (12 earlier) <8760mg6a31.fsf@bsb.me.uk> <6669c766-06eb-49b1-9b69-7a3802e1b673@googlegroups.com> <o39b9l$36j$1@dont-email.me> <4f19b676-b77c-4897-aec0-87daaa34c589@googlegroups.com> <87bmw77k0z.fsf@bsb.me.uk> |
Groovy hepcat Ben Bacarisse was jivin' in comp.lang.c on Tue, 20 Dec
2016 7:15 am. It's a cool scene! Dig it.
> Dexterr <dejangru@gmail.com> writes:
> <snip>
>
>> But one more question - what to do when you have file with 4 fields
>> in one line and only the fourth field has such a form ???
>>
>> R1 0 1 (100/1)
>> C0 1 2 (1/1000000)
>> L1 2 3 (47/1000)
>
> It's hard to say without knowing (a) what the general pattern is and
> (b)
> what you are going to do with the data. For example, with you always
> have R, C or L at the start (excepting comment lines of course)? Will
> there always be a digit following that letter? Do you need to store
> that initial letter? Is the third field always one more than the
> second?
>
> My guess is that you will need a format like this:
>
> "%c%d %d %d (%d/%d)"
My guess is that R1, C0 and L1 are identifiers of some sort. Anyhow,
each does seem to be a single token. So a more likely solution would be
something like this:
"%s %d %d (%d/%d)"
Also, from Dexterr's other thread, he seems to want to read in the
arithmetic expression as a single field first, and then parse and
calculate it later (though I could be wrong). So maybe what he needs is
this:
"%s %d %d %s"
or, even better, since he's specified in the other thread the sizes of
arrays in which he is storing the data (5 for the identifier and 25 for
the arithmetic expression), this:
"%4s %d %d %24s"
and later, parse the arithmetic expression with this format string:
"(%d/%d)"
> Can you, from reading the documentation about sscanf, work out if this
> is what you need and how you would write sscanf call?
>
> My second guess is that "[RCL]%*d %d %*d (%d/%d)" will also do fine
I *think* you meant this:
"%[RCL]%d %d %d (%d/%d)"
> but I can't tell without knowing a lot more about the problem.
--
----- Dig the NEW and IMPROVED news sig!! -----
-------------- Shaggy was here! ---------------
Ain't I'm a dawg!!
Back to comp.lang.c | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[Structure of Array] pointer arithmetic in structures Dexterr <dejangru@gmail.com> - 2016-12-18 07:51 -0800
Re: [Structure of Array] pointer arithmetic in structures fir <profesor.fir@gmail.com> - 2016-12-18 08:15 -0800
Re: [Structure of Array] pointer arithmetic in structures Dexterr <dejangru@gmail.com> - 2016-12-18 09:31 -0800
Re: [Structure of Array] pointer arithmetic in structures BartC <bc@freeuk.com> - 2016-12-18 16:27 +0000
Re: [Structure of Array] pointer arithmetic in structures Dexterr <dejangru@gmail.com> - 2016-12-18 09:43 -0800
Re: [Structure of Array] pointer arithmetic in structures BartC <bc@freeuk.com> - 2016-12-18 18:13 +0000
Re: [Structure of Array] pointer arithmetic in structures Dexterr <dejangru@gmail.com> - 2016-12-18 10:31 -0800
Re: [Structure of Array] pointer arithmetic in structures Barry Schwarz <schwarzb@dqel.com> - 2016-12-18 10:39 -0800
Re: [Structure of Array] pointer arithmetic in structures Dexterr <dejangru@gmail.com> - 2016-12-18 10:02 -0800
Re: [Structure of Array] pointer arithmetic in structures Barry Schwarz <schwarzb@dqel.com> - 2016-12-18 10:20 -0800
Re: [Structure of Array] pointer arithmetic in structures Dexterr <dejangru@gmail.com> - 2016-12-18 10:40 -0800
Re: [Structure of Array] pointer arithmetic in structures Barry Schwarz <schwarzb@dqel.com> - 2016-12-18 10:54 -0800
Re: [Structure of Array] pointer arithmetic in structures Dexterr <dejangru@gmail.com> - 2016-12-18 11:10 -0800
Re: [Structure of Array] pointer arithmetic in structures BartC <bc@freeuk.com> - 2016-12-18 18:54 +0000
Re: [Structure of Array] pointer arithmetic in structures Dexterr <dejangru@gmail.com> - 2016-12-18 11:05 -0800
Re: [Structure of Array] pointer arithmetic in structures Dexterr <dejangru@gmail.com> - 2016-12-18 11:22 -0800
Re: [Structure of Array] pointer arithmetic in structures BartC <bc@freeuk.com> - 2016-12-18 19:38 +0000
Re: [Structure of Array] pointer arithmetic in structures Dexterr <dejangru@gmail.com> - 2016-12-18 11:45 -0800
Re: [Structure of Array] pointer arithmetic in structures Ben Bacarisse <ben.usenet@bsb.me.uk> - 2016-12-18 20:07 +0000
Re: [Structure of Array] pointer arithmetic in structures Dexterr <dejangru@gmail.com> - 2016-12-18 12:35 -0800
Re: [Structure of Array] pointer arithmetic in structures Ben Bacarisse <ben.usenet@bsb.me.uk> - 2016-12-18 21:26 +0000
Re: [Structure of Array] pointer arithmetic in structures Dexterr <dejangru@gmail.com> - 2016-12-18 13:47 -0800
Re: [Structure of Array] pointer arithmetic in structures Ben Bacarisse <ben.usenet@bsb.me.uk> - 2016-12-19 00:23 +0000
Re: [Structure of Array] pointer arithmetic in structures Dexterr <dejangru@gmail.com> - 2016-12-19 10:53 -0800
Re: [Structure of Array] pointer arithmetic in structures BartC <bc@freeuk.com> - 2016-12-19 19:11 +0000
Re: [Structure of Array] pointer arithmetic in structures Dexterr <dejangru@gmail.com> - 2016-12-19 11:20 -0800
Re: [Structure of Array] pointer arithmetic in structures BartC <bc@freeuk.com> - 2016-12-19 19:31 +0000
Re: [Structure of Array] pointer arithmetic in structures Ben Bacarisse <ben.usenet@bsb.me.uk> - 2016-12-19 20:06 +0000
Re: [Structure of Array] pointer arithmetic in structures Dexterr <dejangru@gmail.com> - 2016-12-19 11:27 -0800
Re: [Structure of Array] pointer arithmetic in structures BartC <bc@freeuk.com> - 2016-12-19 19:40 +0000
Re: [Structure of Array] pointer arithmetic in structures Dexterr <dejangru@gmail.com> - 2016-12-19 12:09 -0800
Re: [Structure of Array] pointer arithmetic in structures Ben Bacarisse <ben.usenet@bsb.me.uk> - 2016-12-19 20:15 +0000
Re: [Structure of Array] pointer arithmetic in structures "Peter \"Shaggy\" Haywood" <phaywood@alphalink.com.au> - 2016-12-24 17:12 +1100
Re: [Structure of Array] pointer arithmetic in structures Barry Schwarz <schwarzb@dqel.com> - 2016-12-19 16:15 -0800
csiph-web