Thread: Arrays from a file

  1. #1

    Arrays from a file

    Hi! I want to write multi line arrays (3D?, you know the ones you declare like int array[5][12];) to a file, then read it, and put it into another array.

    Basically I'm making a map editor that exports the map you make into the numbers that are in the array, then when you are in the game I need it to read this map file, and set an array to what the file says, exactly how it says in the files. And if you can, not required, make it to where if there is a semicolon in a line it makes it a comment.

  2. #2
    BTW: I am using DJGPP and I am programming in console.

  3. #3
    ¡Amo fútbol!
    Join Date
    Dec 2001
    To create a 3d array with 7 rows, 6 columns, and 5 columns deep, declare it as the following

    int array[7][6][5];

    As for your other question, look up fstream and fstream.h.

  4. #4
    That is what I thought it was, that is why I put ? after 3d. So that means the ones I'm using are 2D, and the ones with only one line are 1D?

    I've been searching fstream on the internet, but haven't found anything I can understand.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Newbie homework help
    By fossage in forum C Programming
    Replies: 3
    Last Post: 04-30-2009, 04:27 PM
  2. File transfer- the file sometimes not full transferred
    By shu_fei86 in forum C# Programming
    Replies: 13
    Last Post: 03-13-2009, 12:44 PM
  3. Formatting a text file...
    By dagorsul in forum C Programming
    Replies: 12
    Last Post: 05-02-2008, 03:53 AM
  4. gcc link external library
    By spank in forum C Programming
    Replies: 6
    Last Post: 08-08-2007, 03:44 PM
  5. Replies: 3
    Last Post: 03-04-2005, 02:46 PM