Hi firstly it's what i am doing:
out << (quint16) 0;
QByteArray data;
QDataStream out(&data, QIODevice::WriteOnly);
out.setVersion(QDataStream::Qt_4_7);
out << (quint16) 0;
To copy to clipboard, switch view to plain text mode
next i put some qstrings, integers to out
after it i want to put data to the file:
QFile file(tr
("%1.txt").
arg(receiver
));
file.write(data);
file.close();
QFile file(tr("%1.txt").arg(receiver));
file.open(QIODevice::WriteOnly);
file.write(data);
file.close();
To copy to clipboard, switch view to plain text mode
and after this i've got in document:
\00V\00\00\00\00\00\E8\00\00\00
\00M\00i\00s\00i\00a\00\00\00<\00a\00d\00w\00a\00k\00e\00l\002\001\003\001\002\003\00k\00l\00a\00w\00j\00e\00a\00w\00l\00k\00e\00j\00 \002\002\002\002
\00V\00\00\00\00\00\E8\00\00\00
\00M\00i\00s\00i\00a\00\00\00<\00a\00d\00w\00a\00k\00e\00l\002\001\003\001\002\003\00k\00l\00a\00w\00j\00e\00a\00w\00l\00k\00e\00j\00 \002\002\002\002
To copy to clipboard, switch view to plain text mode
what's the problem?
after this i want to open file and show in text browser:
QFile o_file
(tr
("%1.txt").
arg(clientNumber
));
Form *w= new Form(this);
w->show();
w->show2(data2);
QFile o_file(tr("%1.txt").arg(clientNumber));
o_file.open(QIODevice::ReadOnly);
QByteArray data2 = o_file.readAll();
Form *w= new Form(this);
w->show();
w->show2(data2);
To copy to clipboard, switch view to plain text mode
{
ui->text->append(c);
}
void Form::show2(QByteArray a)
{
QString c(a);
ui->text->append(c);
}
To copy to clipboard, switch view to plain text mode
and after this i don't see anything, firstly why i got this funny data in document, and why i couldn't show it in my browser text?
Bookmarks