PDA

View Full Version : Problem saving txtfile contents to database



cutie.monkey
6th January 2010, 08:11
hi folks,

i got here a program reading an encrypted textfile then save the data to MySql database.
i read the textfile using this code:



QFile fr(qApp->applicationDirPath() + "/fptemplate.txt");
if (!fr.open(QIODevice::ReadOnly))
return;
QByteArray byte = fr.readAll();
fr.close();


then i try to debug 'byte', this returns empty.
but when i try to create a new file then write the data of 'byte', is written correctly.

my problem here is this, how can i get the data of 'byte' then append it to string so i can
create mysql query then save it to database?

i attached here the sample textfile im working for.

thnks and i hop someone can help me solve my problem.