An array and file reading question
From: Walt L. Williams (wwilliams_at_intergate.com)
Date: 11/22/04
- Next message: Watson Davis: "Re: Learning C++"
- Previous message: Francis Glassborow: "Re: Learning C++"
- Next in thread: Anthony Borla: "Re: An array and file reading question"
- Reply: Anthony Borla: "Re: An array and file reading question"
- Reply: Dietmar Schindler: "Re: An array and file reading question"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Mon, 22 Nov 2004 15:47:14 -0700
Greetings
I am learning C and have a question.
I needing to load a 2D array from a file
containing integers. The file is set up in
matrix form. I need to read the individual
integers from each row and place it into the
array rows. The first row in the file will
contain two numbers telling how big to make
the array. Is there a function similar to
getc that can do this?
After searching around in some reference books
that I have I thought about reading in the whole
line as a string and using strtok to recognize
the spaces between the numbers as a token and
then using this to break up the string into
seperate entities and placing them into the
array elements while casting them as "int"s.
I need the input as integers so I can do
mathmatical operations between two numberical
arrays.
I am not overly experenced so I am open to
whatever thoughts anyone may have.
Thanks
-- Walt L. Williams
- Next message: Watson Davis: "Re: Learning C++"
- Previous message: Francis Glassborow: "Re: Learning C++"
- Next in thread: Anthony Borla: "Re: An array and file reading question"
- Reply: Anthony Borla: "Re: An array and file reading question"
- Reply: Dietmar Schindler: "Re: An array and file reading question"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|