Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.c > #76232

Re: Please help -- cannot read double data from file into array

From Ben Bacarisse <ben.usenet@bsb.me.uk>
Newsgroups comp.lang.c
Subject Re: Please help -- cannot read double data from file into array
Date 2015-11-17 11:04 +0000
Organization A noiseless patient Spider
Message-ID <87y4dwzy2p.fsf@bsb.me.uk> (permalink)
References <bb0cef7b-950a-4fcb-a7c9-2a8fbe558cd7@googlegroups.com> <n2evvk$dke$1@speranza.aioe.org>

Show all headers | View raw


gamo <gamo@telecable.es> writes:

> El 17/11/15 a las 09:39, dakupoto@gmail.com escribió:
>> Could some C kanguage guru please help ?
>> I am trying to read double data from a
>> simple text file into an array. The data
>> can be read in correctly, but I am unable
>> use the values read into the array, later.
>>
>> The input file looks like:
>> 0       5.091259e-09    -2.16165e+01
>> 1       5.213820e-09    -2.76803e+01
>
> I'm not a guru, I'm dumb.
> Why don't you use fscanf?

I agree about using a scanf function, but with fscanf there is no easy
way to check the line-based format.  Reading a line and using sscanf
can do that very easily.

However, if checking the data format is not very important, then fscanf
will be even simpler.

-- 
Ben.

Back to comp.lang.c | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Please help -- cannot read double data from file into array dakupoto@gmail.com - 2015-11-17 00:39 -0800
  Re: Please help -- cannot read double data from file into array Malcolm McLean <malcolm.mclean5@btinternet.com> - 2015-11-17 00:54 -0800
  Re: Please help -- cannot read double data from file into array gamo <gamo@telecable.es> - 2015-11-17 11:36 +0100
    Re: Please help -- cannot read double data from file into array Ben Bacarisse <ben.usenet@bsb.me.uk> - 2015-11-17 11:04 +0000
  Re: Please help -- cannot read double data from file into array Ben Bacarisse <ben.usenet@bsb.me.uk> - 2015-11-17 11:02 +0000
  Re: Please help -- cannot read double data from file into array James Kuyper <jameskuyper@verizon.net> - 2015-11-17 06:51 -0500
  Re: Please help -- cannot read double data from file into array BartC <bc@freeuk.com> - 2015-11-17 12:08 +0000
    Re: Please help -- cannot read double data from file into array Ben Bacarisse <ben.usenet@bsb.me.uk> - 2015-11-17 13:28 +0000
      Re: Please help -- cannot read double data from file into array BartC <bc@freeuk.com> - 2015-11-17 14:20 +0000
        Re: Please help -- cannot read double data from file into array dakupoto@gmail.com - 2015-11-17 20:50 -0800
          Re: Please help -- cannot read double data from file into array Ben Bacarisse <ben.usenet@bsb.me.uk> - 2015-11-18 11:22 +0000
            Re: Please help -- cannot read double data from file into array BartC <bc@freeuk.com> - 2015-11-18 12:15 +0000
            Re: Please help -- cannot read double data from file into array dakupoto@gmail.com - 2015-11-18 23:07 -0800
              Re: Please help -- cannot read double data from file into array Ben Bacarisse <ben.usenet@bsb.me.uk> - 2015-11-19 10:41 +0000
              Re: Please help -- cannot read double data from file into array BartC <bc@freeuk.com> - 2015-11-19 11:13 +0000

csiph-web