vector read specific lines

I have a text file that contains names of shows and people who starred in them.

I need to create a vector in a class where i can type in the actor and it will output the movie.

But i don't want to read this whole entry into a vector to save memory.

How can i make it so that i would read this txt file that includes this below, and then finds the actors name for example Min, Jun So it will find both instances, then read both movies into the vector and output it?

Just maybe a layout of a code that would do this would be awesome. Just to get me started.

Min, Elia
    Starlight Inn (2010)  [Skyler]  <4>

Min, Jun So
    "Joseon X-Files - Secret Book" (2010) {Ghosts of Yidu (#1.6)}  [Choi Eui Shin]  <5>

Min, Jung So
    "Mischievous Kiss" (2010)  [Oh Ha Ni]

Min, Xiao
    Little Sister (2010)  [Mei Mei]  <2>


Try ths sample code:

#include <string>
#include <iostream>
#include <fstream>
#include <vector>
using namespace std;

int main()
    std::ifstream file( "test.txt" ) ;
    std::string search_str = "Elia" ;
    std::string line ;
    int line_number = 0 ;
    std::vector<string> finds;

    while( std::getline( file, line ) )
        ++line_number ;
        if( line.find(search_str) != std::string::npos )
            std::cout << "line " << line_number << ": " << line << '\n' ;
            std::getline( file, line );

    for (int i=0;i<finds.size();i++)

    return 0;

Input: Elia


Min, Elia
    Starlight Inn (2010)  [Skyler]  <4>
Press any key to continue

Need Your Help

Doing a proper Join with SQL

php mysql sql

Suppose I have two tables, one with list of spells and another with a grimory, the list of spells that a user has selected for learn or already learned.

Why ruby modulo is different from java/other lang ?

java ruby modulo

i am basically coming from java background and struggling to understand the modulo operation in Ruby.

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.