Thread: Searching a file for a String Occurence

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Registered User
    Join Date
    Dec 2008
    Posts
    65

    Exclamation Searching a file for a String Occurence

    Okay, I can't read anymore about file I/O.

    I have the follow class:
    Code:
    class Student
    {
    private:
        std::string studentName;
        int numberDaysPresent;
        int numberDaysAbsent;
        int totalDaysOfClass;
        double currentGrade;
    }
    I read the data in from a comma delimited text file, and create 543 Student objects that contain that data.

    What I want to do now is search a different data file for all occurences of Student[x].studentName. But I do not want to load the other file completely in memory because it contains 11000 lines of data (and takes forever to load) in the following comma delimited format:
    DATE OF CLASS, STUDENT NAME, CLASS PARTICIPATION GRADE, QUIZ GRADE.

    I have been chewing on this one for several days, and haven't been able to figure it out. Any suggestions would be greatly appreciated.

    Cheers!

    EDIT:
    I then want to grab just the data from the file that relates to the matched student and assign it to the following class:
    Code:
    class OldStudentData
    {
        std::string dateOfClass;
        std::string studentName;
        double participationGrade;
        double quizGrade;
    }
    Last edited by Phyxashun; 01-07-2009 at 01:15 PM.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Inheritance Hierarchy for a Package class
    By twickre in forum C++ Programming
    Replies: 7
    Last Post: 12-08-2007, 04:13 PM
  2. Replies: 6
    Last Post: 01-03-2007, 03:02 PM
  3. C++ std routines
    By siavoshkc in forum C++ Programming
    Replies: 33
    Last Post: 07-28-2006, 12:13 AM
  4. Post...
    By maxorator in forum C++ Programming
    Replies: 12
    Last Post: 10-11-2005, 08:39 AM
  5. Dikumud
    By maxorator in forum C++ Programming
    Replies: 1
    Last Post: 10-01-2005, 06:39 AM