Salve.
Sto riscontrando un fastidioso problema.
In sintesi: ho un file txt in cui aggiungo mano mano stringhe, del tipo: "nome1 \r\n nome2\r\n nome3 \r\n" che appare, giustamente, così:
codice:
nome1
nome2
nome3
Ora, la mia intenzione è quella di leggere il contenuto del file e riportarlo in un RichEdit.
codice:
void load(){
string line; //this will contain the data <strong class="highlight">read[/b] from the file
ifstream myfile ("a.txt"); //opening the file.
if (myfile.is_open()) //if the file is open
{
while (! myfile.eof() ) //while the end of file is NOT reached
{
getline (myfile,line); //get one line from the file
cout << line << endl; //and output it
}
myfile.close(); //closing the file
} else cout << "Unable to open file"; //if the file is not open output <--
Form1->RichEdit1->Text = "";
Form1->RichEdit1->Text = Form1->RichEdit1->Text + line.c_str();
}
Ottenendo però come risultato, nel RichEdit:
Come diavolo faccio a risolvere? Grazie in anticipo.