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


Groups > comp.lang.c > #12867

Re: newby question on C I/O

From Eric Sosman <esosman@ieee-dot-org.invalid>
Newsgroups comp.lang.c
Subject Re: newby question on C I/O
Date 2011-11-07 20:56 -0500
Organization A noiseless patient Spider
Message-ID <j9a2a0$isv$1@dont-email.me> (permalink)
References <0f0ee88e-09f4-43ca-8c95-84f9a4846455@c1g2000vbw.googlegroups.com> <j9217v$t4r$1@dont-email.me> <ebe91406-a5b0-4b9e-a5df-ebee60b16047@w7g2000yqc.googlegroups.com>

Show all headers | View raw


On 11/7/2011 8:10 PM, analyst41@hotmail.com wrote:
> On Nov 4, 7:50 pm, Eric Sosman<esos...@ieee-dot-org.invalid>  wrote:
>> On 11/4/2011 6:07 PM, analys...@hotmail.com wrote:
>>
>>> I have a file that looks like
>>
>>> Value Cost Special_Status
>
> OK I typed the code in.  The compiler complained about the character
> field and I changed it to integer (1=yes, 0 = no).

     Sorry: My blunder.  I should have written just `costs[j]', not
`&costs[j]'.

> #include<stdio.h>
> #include<stdlib.h>
>
>         void getdat(float values[], float costs[], int statuses[], int
> items) ;
>         void main()

     Oh, Lordy, Lordy, Lordy, will you ever catch flak for this!

>[...]
> I also put the number of rows in row 2 (not being able to read till
> EOF in C and counting the number of rows read)

     Certainly you can do that, and it's easy.  But I couldn't read
your Fortran-ized FORTRAN, so you've got to cut me some slack: I was
only guessing at what your Fortroid code was doing.

> I can verify from the function that it is working correctly;  But I am
> not able to use what was read in main.
> [...]

     Yeah.  Well.  Did you read my description of the code I supplied?
Did you see the adjective "TERRIBLE?"  Did you comprehend that it was
only the barest of a bare-bones sketch, not suitable for actual use in
battlefield conditions?  And did you go ahead and use it anyhow???

     Some might say that you will never get anywhere by copying code
verbatim without trying to understand it.  They're wrong: You will, in
fact, get somewhere.  Somewhere unpleasant.

     C is a powerful tool, but a tool without finger guards, without
kickback arrestors, without deadman switches.  If Fortran has accustomed
you to such safeguards (FORTRAN would not have), be warned that you are
in mortal peril.  Do Not, repeat, Do Not attempt to write C without
learning the language first; you are in danger and may put others there.

-- 
Eric Sosman
esosman@ieee-dot-org.invalid

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


Thread

newby question on C I/O "analyst41@hotmail.com" <analyst41@hotmail.com> - 2011-11-04 15:07 -0700
  Re: newby question on C I/O Eric Sosman <esosman@ieee-dot-org.invalid> - 2011-11-04 20:50 -0400
    Re: newby question on C I/O "analyst41@hotmail.com" <analyst41@hotmail.com> - 2011-11-04 18:57 -0700
    Re: newby question on C I/O "analyst41@hotmail.com" <analyst41@hotmail.com> - 2011-11-07 17:10 -0800
      Re: newby question on C I/O Ian Collins <ian-news@hotmail.com> - 2011-11-08 14:47 +1300
      Re: newby question on C I/O "BartC" <bc@freeuk.com> - 2011-11-08 01:52 +0000
      Re: newby question on C I/O Eric Sosman <esosman@ieee-dot-org.invalid> - 2011-11-07 20:56 -0500
        Re: newby question on C I/O Edward Rutherford <edward.p.rutherford79@REMOVETHIS.gmail.com> - 2011-11-08 20:27 +0000
          Re: newby question on C I/O Eric Sosman <esosman@ieee-dot-org.invalid> - 2011-11-08 20:48 -0500
          Re: newby question on C I/O "BartC" <bc@freeuk.com> - 2011-11-09 11:12 +0000
            Re: newby question on C I/O James Kuyper <jameskuyper@verizon.net> - 2011-11-09 07:02 -0500
              Re: newby question on C I/O Ben Bacarisse <ben.usenet@bsb.me.uk> - 2011-11-09 16:12 +0000
        Re: newby question on C I/O - SUCCESS "analyst41@hotmail.com" <analyst41@hotmail.com> - 2011-11-08 16:12 -0800
  Re: newby question on C I/O James Kuyper <jameskuyper@verizon.net> - 2011-11-04 21:46 -0400
    Re: newby question on C I/O Ike Naar <ike@iceland.freeshell.org> - 2011-11-05 06:52 +0000
      Re: newby question on C I/O Malcolm McLean <malcolm.mclean5@btinternet.com> - 2011-11-05 04:13 -0700
      Re: newby question on C I/O James Kuyper <jameskuyper@verizon.net> - 2011-11-05 08:16 -0400
        Re: newby question on C I/O Eric Sosman <esosman@ieee-dot-org.invalid> - 2011-11-05 09:21 -0400
      Re: newby question on C I/O Eric Sosman <esosman@ieee-dot-org.invalid> - 2011-11-05 09:13 -0400
    Re: newby question on C I/O David Thompson <dave.thompson2@verizon.net> - 2011-11-21 02:39 -0500
      Re: newby question on C I/O James Kuyper <jameskuyper@verizon.net> - 2011-11-21 10:05 -0500
        Re: newby question on C I/O David Thompson <dave.thompson2@verizon.net> - 2012-01-19 02:40 -0500
  Re: newby question on C I/O "BartC" <bc@freeuk.com> - 2011-11-06 21:23 +0000
  Re: newby question on C I/O "analyst41@hotmail.com" <analyst41@hotmail.com> - 2011-11-10 18:00 -0800
    Re: newby question on C I/O Malcolm McLean <malcolm.mclean5@btinternet.com> - 2011-11-11 01:35 -0800
      Re: newby question on C I/O gazelle@shell.xmission.com (Kenny McCormack) - 2011-11-11 11:26 +0000
        Re: newby question on C I/O Malcolm McLean <malcolm.mclean5@btinternet.com> - 2011-11-11 04:41 -0800
          Re: newby question on C I/O gazelle@shell.xmission.com (Kenny McCormack) - 2011-11-11 14:14 +0000
            Re: newby question on C I/O Malcolm McLean <malcolm.mclean5@btinternet.com> - 2011-11-11 07:02 -0800
              Re: newby question on C I/O gazelle@shell.xmission.com (Kenny McCormack) - 2011-11-11 15:44 +0000

csiph-web