Arrays from a file

This is a discussion on Arrays from a file within the C++ Programming forums, part of the General Programming Boards category; Hi! I want to write multi line arrays (3D?, you know the ones you declare like int array[5][12];) to a ...

  1. #1
    Banned frenchfry164's Avatar
    Join Date
    Oct 2001
    Posts
    1,552

    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
    Banned frenchfry164's Avatar
    Join Date
    Oct 2001
    Posts
    1,552
    BTW: I am using DJGPP and I am programming in console.

  3. #3
    ¡Amo fútbol!
    Join Date
    Dec 2001
    Posts
    2,136
    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
    Banned frenchfry164's Avatar
    Join Date
    Oct 2001
    Posts
    1,552
    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, 05: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, 01:44 PM
  3. Formatting a text file...
    By dagorsul in forum C Programming
    Replies: 12
    Last Post: 05-02-2008, 04:53 AM
  4. gcc link external library
    By spank in forum C Programming
    Replies: 6
    Last Post: 08-08-2007, 04:44 PM
  5. Replies: 3
    Last Post: 03-04-2005, 02:46 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21