[solved] QTextStream \n does not function
-
@
QFile file_datiGenerali("C:/TemperamentvolleSMS/datiGenerali.txt");
if(file_datiGenerali.open(QIODevice::Append | QIODevice::ReadWrite))
{
QTextStream stream_fileDatiGenerali(&file_datiGenerali);
qDebug() << "i am in importasms";
stream_fileDatiGenerali.setCodec("UTF-8");
stream_fileDatiGenerali << "USATO GIA<br>";
stream_fileDatiGenerali << "ciao";
this->visualizzaSchermataBase();
}
@
does not start.
i tried too:
@
stream_fileDatiGenerali << "USATO GIA\n";
stream_fileDatiGenerali << "ciao";stream_fileDatiGenerali << "USATO GIA" << endl; stream_fileDatiGenerali << "ciao"; stream_fileDatiGenerali << "USATO GIA" << '\n'; stream_fileDatiGenerali << "ciao";
@
nothing...Edit: fixed spelling mistake in title; Andre
-
do you get the "i am in importasms" output?
-
bq. QFile file_datiGenerali("C:/TemperamentvolleSMS/datiGenerali.txt");
Are you sure with the slashes ;) ??
-
[quote author="Rahul Das" date="1314188375"]bq. QFile file_datiGenerali("C:/TemperamentvolleSMS/datiGenerali.txt");
Are you sure with the slashes ;) ??[/quote]
Yes. That is correct, and the recommended way of dealing with file paths. Internally, use forward slashes, only convert to the native format when presenting to the user. Qt will handle the slashes just fine. -
Oh ok! Thank you Andre. That something new to me.
-
Try adding the QIODevice::Text flag
-
You should tell us, what you do expect to be in the file, and what does it actually contain. Probably using some hexdump utility to show the actual bytes.
-
bq. what you do expect to be in the file
i want it comes so:
"USATO GIA
ciao".bq. do you get the “i am in importasms” output?
i get “i am in importasms” output.
bq. what does it actually contain
i create the file
i will use the app on device n c5-03!
-
So what is the output of the file that gets written?
-
bq. by octal Try adding the QIODevice::Text flag
this was the solution (windows 7)