Hi guys, im experimenting with vector functions, but are unable to come up with anythin constructive.

basically i have this file that contains information. sorta like a friends list. I need to store in an array, and i decided to use vectors for this. Any help please?

data.txt

<div id="featured" class="component">
      <div class="header">
        <h2 class="header-title">List </h2>
      </div>
      <div class="content">

<div class="container">
      
        
	 <div class="dd">
     
	  
	  
	 </div>

        
        <div class="fr_num">1.</div>
        <div class="fr_name">Gary</div>
        
        
	 <div class="dd">
     
	  
	  
	 </div>
        
        <div class="fr_num">2.</div>
        <div class="fr_name">Alex</div>
        
        
	 <div class="dd">

     
	  
	  
	 </div>
        
        <div class="fr_num">3.</div>
        <div class="fr_name">Mollyr</div>
        
        
	 <div class="dd">
     
	  
	  
	 </div>
        
        <div class="fr_num">4.</div>
        <div class="fr_name">Spunk</div>

        
        
	 <div class="dd">
     
	  
	  
	 </div>
        
        <div class="fr_num">5.</div>
        <div class="fr_name">Dida</div>
        
        
	 <div class="dd">
     
	  
	  
	 </div>
        
        <div class="fr_num">6.</div>

        <div class="fr_name">Telex</div>
        
        
	 <div class="dd">
     
	  
	  
	 </div>
        
        <div class="fr_num">7.</div>
        <div class="fr_name">Sunny</div>
        
        
	 <div class="dd">
     
	  
	  
	 </div>

        
        <div class="fr_num">8.</div>
        <div class="fr_name">Tether</div>
        
        
	 <div class="dd">
     
	  
	  
	 </div>
        
        <div class="fr_num">9.</div>
        <div class="fr_name">DiscoDuck</div>
        
        
      
	</div>

    <div class="footer3"></div>
  </div>

When a line of text is read from the file check to see if it contains "fr_name". If it does, then extract the name and put it into the vector. std::vector<std::string> friends;

do u mean using line.find?

for example line.find("fr_name"); then proceeding to put into std::vector<std::string> friends; ?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.