a quick file I/O question

This is a discussion on a quick file I/O question within the C++ Programming forums, part of the General Programming Boards category; hi all new C++ program with *SOME* experence how do i wright to files and be able to store mutuple ...

  1. #1
    Registered User
    Join Date
    Jun 2005
    Posts
    5

    a quick file I/O question

    hi all

    new C++ program with *SOME* experence

    how do i wright to files and be able to store mutuple varables,like in a .ini file or such

    thats my only questin...

  2. #2
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    21,636
    You might want to read the tutorials that this website offers, including the one on C++ File I/O.
    C + C++ Compiler: MinGW port of GCC
    Version Control System: Bazaar

    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  3. #3
    Registered User
    Join Date
    Jun 2005
    Posts
    5
    i looked at that,but it dosent tell me how to store mutuple varables

    it only tells me that itll go into a string of leters numbers and chartars

    what i want to know is how to store MUTUPLE varables and strings in a single file

  4. #4
    ZuK
    ZuK is offline
    Registered User
    Join Date
    Aug 2005
    Location
    Austria
    Posts
    1,990
    Quote Originally Posted by montablac
    what i want to know is how to store MUTUPLE varables and strings in a single file
    This question doesn't make much sense to me. If you know how to output one value there should not be a problem to to the same thing again.
    Show us an example of how your outputfile should look like.
    Kurt

  5. #5
    Information Crocodile
    Join Date
    Dec 2004
    Posts
    204
    So you want an instant code that reads an ini file? is that it?

  6. #6
    Registered User
    Join Date
    Jun 2005
    Posts
    5
    @ Zuk:
    have you ever opened a .ini file,kinda like that

    @ ioko:
    yea,any help on this

  7. #7
    ZuK
    ZuK is offline
    Registered User
    Join Date
    Aug 2005
    Location
    Austria
    Posts
    1,990
    Quote Originally Posted by montablac
    how do i wright to files and be able to store mutuple varables
    Quote Originally Posted by montablac
    ,like in a .ini file or such
    So you want to write to an ini-file but it could be a different format as well.
    Quote Originally Posted by montablac
    i looked at that,but it dosent tell me how to store mutuple varables
    it only tells me that itll go into a string of leters numbers and chartars
    Now I understand you know how to write one value to a file but you don't know how to do it multiple times.
    Quote Originally Posted by montablac
    @ Zuk:
    have you ever opened a .ini file,kinda like that
    Now I know that you actually don't want to write a file.
    It's reading an .ini file what you really want.

    And yes I have done that before. It's very straightforward.
    Code:
    read a line from the file
        if the first non whirspace character is a '[' its a section. cut the '[' and the ']' and you have the name of the section.
        else if  the line contains a '=' the part before the '=' is a variable name the part after the '=' is the value.
           now you just have to check if the value-part is a number or a string
    continue until eof is reached.
    show some code that we can help with actual problems and don't let us guess about your intentions.
    Kurt

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. File i/o and ASCII question
    By muzihc in forum C Programming
    Replies: 13
    Last Post: 11-04-2008, 10:46 PM
  2. Question regarding File I/O
    By mhenderson in forum C Programming
    Replies: 4
    Last Post: 08-03-2006, 12:46 PM
  3. C++ std routines
    By siavoshkc in forum C++ Programming
    Replies: 33
    Last Post: 07-28-2006, 12:13 AM
  4. C++ File I/O question
    By zero_cool in forum C++ Programming
    Replies: 3
    Last Post: 08-16-2005, 10:43 AM
  5. File I/O on Network drive, Quick Question
    By kransk in forum C++ Programming
    Replies: 3
    Last Post: 11-24-2003, 08:17 AM

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