title: Read text file into string. C++ ifstream
body: <pre><code>void docDB(){
       int sdb = 0;
       ifstream dacb("kitudacbiet.txt");
       if(!dacb.is_open())
           cout&lt;&lt;"Deo doc dc file"&lt;&lt;endl;
       else{
            while(!dacb.eof()){
                 dacb&gt;&gt;dbiet[sdb].kitu;
                 dacb&gt;&gt;dbiet[sdb].mota;
                 //getline(dacb,dbiet[sdb].mota);
                 /*
                 string a="";
                 while((dacb&gt;&gt;a)!= '\n'){
                  //strcat(dbiet[sdb].mota,a);
                  dbiet[sdb].mota+=a;
                 }
                 */
                 sdb++;
            }
       }
  
  }
  </code></pre>
  
  <p>Text file: "kitudacbiet.txt"</p>
  
  <pre><code>\ Dau xuyet phai
  @ Dau @
  # Dau #
  $ Ky hieu $
  ( Dau mo ngoac
  ) Dau dong ngoac
  </code></pre>
  
  <p><img src="https://i.stack.imgur.com/oL8Ly.png" alt="Screen"></p>
  
  <p>I want read firt string of line into dbiet[sdb].kitu and the rest of line into dbiet[sdb].mota </p>
  
  <p>Example: line 1 =   \ Dau xuyet phai </p>
  
  <p>dbiet[sdb].kitu = "\" and dbiet[sdb].mota = "Dau xuyet phai"</p>
  
  <p>I would like to read line by line until i met downline character ('\n'). How to do this.
  Sorry my english not good.Thank</p>