Thread: fstream

  1. #1
    Sanity is for the weak! beene's Avatar
    Join Date
    Jul 2006
    Posts
    321

    fstream

    Hi, havn't posted in a while lads and lasses, been designing my text engine.

    Anyways....... I was thinking that instead of hardcoding all the text in the program, I could write the storyline, directions etc.... in text file(s). It would save alot of my time coding. But this is where i'm sort of in a debate with myself, should I write a class/function to load/close the text file when needed\not needed or just load it whenever I need it? If it's the first option then can you kind people advise me on how to do it, i'm not that good with fstream.

    Thanks

    Beene

  2. #2
    The superhaterodyne twomers's Avatar
    Join Date
    Dec 2005
    Location
    Ireland
    Posts
    2,273
    Use a database library like sqlite (I've not used it, though I do advertise it a bit here for some reason). That way you can easily load whatever segment you want easily and quickly. All you need to do is add the storylines to the database and make your program load the right ones.

  3. #3
    Kiss the monkey. CodeMonkey's Avatar
    Join Date
    Sep 2001
    Posts
    937
    An engine (at least in the spirit of a game engine) is not particularly useful if its resources are compiled into the code.
    So yes, definitely look into fstream or some higher library.
    "If you tell the truth, you don't have to remember anything"
    -Mark Twain

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Problems with fstream, one variabile for write and read
    By Smjert in forum C++ Programming
    Replies: 3
    Last Post: 02-03-2009, 10:19 PM
  2. Fstream. I/O
    By kevinawad in forum C++ Programming
    Replies: 2
    Last Post: 07-07-2008, 09:19 AM
  3. ARGH! fstream errors
    By OttoDestruct in forum C++ Programming
    Replies: 2
    Last Post: 04-29-2004, 10:37 PM
  4. Are fstream and ofstream incompatible?
    By johnnyd in forum C++ Programming
    Replies: 5
    Last Post: 03-19-2003, 12:21 PM
  5. Problems with fstreams.
    By mosdef in forum C++ Programming
    Replies: 7
    Last Post: 06-19-2002, 03:36 PM