An array and file reading question

From: Walt L. Williams (wwilliams_at_intergate.com)
Date: 11/22/04


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


Relevant Pages

  • Help in French|Spanish|German translation.
    ... I am also an author of User-defined string functions. ... WORDTRANEX (cSearched, cArExpressionSought | cExpressionSough, ... each string of the array is searched ... If the parameter nArStartOccurrence is -1 or omitted, the replacement starts ...
    (microsoft.public.fox.helpwanted)
  • Re: passing a string to a dll
    ... Joe, I really appreciate you taking the time to demonstrate this. ... sure how I would implement indexing it for random alphanumeric codes. ... I might handle the array. ... I actually have been wondering if I could use a second string ...
    (microsoft.public.vc.mfc)
  • Re: passing a string to a dll
    ... I might handle the array. ... I actually have been wondering if I could use a second string ... look at insertion cost, organization cost, and search cost. ...
    (microsoft.public.vc.mfc)
  • RE: Structure conversion from C++ to VB-2008?
    ... One of the most important structures is AmiVar structure. ... point number, the array of floating point numbers, a string or IDispatch ... Dim 13012679 as Integer ...
    (microsoft.public.dotnet.languages.vb)
  • Structure conversion from C++ to VB-2008?
    ... One of the most important structures is AmiVar structure. ... point number, the array of floating point numbers, a string or IDispatch ... Dim 13012679 as Integer ...
    (microsoft.public.dotnet.languages.vb)