PDA

View Full Version : Problem to export .bin file to .txt file



Eduardo Huerta
18th June 2018, 19:31
Hello everyone
I am doing a program to acquire data from an NI-USB6008, the acquired data is saved in a .bin file and later the user can export them to a .txt file to open and process the data in Excel. I could save the data in .txt to not make the conversion, but for reasons of privacy among users of the program I am saving them in a .bin file. The problem I have is that the exporting file is not decoded or at least it is not done correctly. I have followed the recommended procedures in the Qt examples, but obviously there is something I am doing wrong. The problem is that I do not find the error. I would appreciate if someone tells me what my mistake is; so as not to take away much of your valuable time I have summarized the program, I add it below. Thanks averyone.

d_stranz
18th June 2018, 22:31
QDataStream is for writing binary files, not text files. You need to open your target QFile with OpenMode "QIODevice:: WriteOnly | QIODevice:: Text" and then you need to use QTextStream to write the text file.