Thread: Reading game data from file

  1. #1
    Registered User
    Join Date
    Mar 2010
    Posts
    20

    Reading game data from file

    I am creating a very simple 2d game ...
    My wall and item placements in the level are read from a text file.
    i.e wall 000 100 100 100 100 200 000 200
    I am unsure what type to read them into.
    I was going to use predefined arrays but the size will change from level to level.
    Would a Vector container be correct or is there something more suitable?

  2. #2
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    28,413
    Yes, std::vector sounds suitable.
    Quote Originally Posted by Bjarne Stroustrup (2000-10-14)
    I get maybe two dozen requests for help with some sort of programming or design problem every day. Most have more sense than to send me hundreds of lines of code. If they do, I ask them to find the smallest example that exhibits the problem and send me that. Mostly, they then find the error themselves. "Finding the smallest program that demonstrates the error" is a powerful debugging tool.
    Look up a C++ Reference and learn How To Ask Questions The Smart Way

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Reading in a file and printing out a graph from the data
    By levitylek in forum C Programming
    Replies: 3
    Last Post: 10-26-2010, 07:32 PM
  2. Replies: 15
    Last Post: 10-20-2009, 09:39 AM
  3. Replies: 7
    Last Post: 02-02-2009, 07:27 AM
  4. Data Structure Eror
    By prominababy in forum C Programming
    Replies: 3
    Last Post: 01-06-2009, 09:35 AM
  5. reading in file data
    By sickofc in forum C Programming
    Replies: 2
    Last Post: 03-01-2006, 05:16 PM