hey all,
First I open a file "cutePOSinvoice.html" that I read with
QTextStream, then I put the content in a QString "templateoutput ". I
replace some text in templateoutput with some other string and then
create a new file "output.html" to write the new templateoutput string
into. Everything works fine except the writing cause when I remove it the app doesn't crash, it might be due to something else but I'm pretty clueless. Any idea what
I'm doing wrong? thanx in advance, here is the code:
QFile invoice
("cutePOSinvoice.html");
return;
QString templateoutput
= in.
readAll();
qDebug() << templateoutput;
invoice.close();
QString clientIDinvoice
= getAccountID
();
templateoutput.
replace (QString("$ClientID"),clientIDinvoice
);
QFile data
("output.html");
if (data.
open(QFile::WriteOnly)) { out << templateoutput;
}
QFile invoice("cutePOSinvoice.html");
if (!invoice.open(QIODevice::ReadOnly | QIODevice::Text))
return;
QTextStream in(&invoice);
QString templateoutput = in.readAll();
qDebug() << templateoutput;
invoice.close();
QString clientIDinvoice = getAccountID();
templateoutput.replace (QString("$ClientID"),clientIDinvoice );
QFile data("output.html");
if (data.open(QFile::WriteOnly)) {
QTextStream out(&data);
out << templateoutput;
}
To copy to clipboard, switch view to plain text mode
Bookmarks