CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4
  1. #1
    Join Date
    Sep 2009

    Unhappy School file i/o program

    So i have an array of structs which holds a student ID number and an instance of the LinkedList class which holds a linked list of the schedule of that student. How would I save all the data using file i/o. And then how would i retrieve that info and put it back into their respective variables? I am very confused. Thank you for your time, help would be greatly appreciated
    Attached Files Attached Files

  2. #2
    Join Date
    Sep 2009

    Re: School file i/o program

    I have been trying to work on it but I am completely lost now.

  3. #3
    Join Date
    Jan 2003

    Re: School file i/o program

    Some info http://www.parashift.com/c++-faq-lit...alization.html

    What specific part of the task are you having a problem with? Does the current code write any, some or all necessary infomation to a file? You currently have a Students::Save method, you probably need a Students::Restore method that does the opposite of save (open file, parse content into StudentNodes and nodes).

    I would recommend not using goto statments in C++ code.
    Before post, make an effort yourself, try googling or search here.

    When posting, give a proper description of your problem, include code* and error messages.

    *All code should include code tags

  4. #4
    Join Date
    Aug 2005
    San Diego, CA

    Lightbulb Re: School file i/o program

    I suggest that you create a simpler project first and practice with simple text files. Just practice writing and reading an array of strings and / or numbers to and from a text file until you get the hang of it. Search the forums for threads related to files and start reading and looking for examples.

    Another place to look is here. Start clicking on the member functions and read some of the examples. If you happen to have a book on streams, read it. If you have never done this before it is going to require some research to get it right.

    If you have used other streams before, learning filestreams shouldn't be too hard. They are generic classes. stringstreams and filestreams inherit from the same base classes used for handling stdin and stdout. You just have to study the member functions and capabilities specific to the filestream, ifilestream, and ofilestream classes.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Windows Mobile Development Center

Click Here to Expand Forum to Full Width

On-Demand Webinars (sponsored)

We have made updates to our Privacy Policy to reflect the implementation of the General Data Protection Regulation.