Thread: From file to integer array

  1. #1
    Registered User
    Join Date
    May 2013

    From file to integer array


    I'm trying to passing values from a text file to an array. The values in txt file is;

    0 2 3 5
    1 2 5
    0 1 3 6
    1 3 5

    I need to store these values in an array like that
    int array[?][?]={{0,2,3,5},{1,2,5},{0,1,3,6},{1,3,5}};
    any idea?

  2. #2
    Join Date
    Oct 2007
    Inside my computer
    Read every line. Push a new line into vector.
    Parse every line and push back integer into a vector.

    You may want to read up about 2d vectors.
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Integer Array Please help
    By jj121 in forum C Programming
    Replies: 10
    Last Post: 05-18-2010, 12:26 PM
  2. integer array to char array?
    By DJPlayer in forum C Programming
    Replies: 4
    Last Post: 10-19-2009, 09:59 PM
  3. integer pointer to an array[][][]
    By jordanguyoflove in forum C Programming
    Replies: 16
    Last Post: 12-23-2008, 12:19 PM
  4. Reading Input from file (Integer array)
    By Govalant in forum C Programming
    Replies: 9
    Last Post: 07-23-2007, 06:13 PM
  5. Converting character array to integer array
    By quiet_forever in forum C++ Programming
    Replies: 5
    Last Post: 04-02-2007, 05:48 AM