PDA

View Full Version : How to Assign a Variable into LineEdit



mcht_z
18th February 2011, 18:51
Hello,

I want to assign a variable from lineedit but cant. For example:


ofstream file("file.txt");

file << ui->LineEdit->text(); //this is not work.
<< ui->LineEdit; // this is write a thing like "00FD7" into the file. I hope its memory address?


thanks for helps

marcvanriet
18th February 2011, 19:53
You could use QTextStream :

QFile data("output.txt");
QTextStream out(&data);
out << ui->LineEdit->text();;

Otherwise, you could use ui->LineEdit->text().toAscii() I think.

Best regards,
Marc

mcht_z
18th February 2011, 19:55
Thank you very much. I was waiting this answer :)