Hello!
I'm planning a software that will plot a graph using Qwt or OpenGL (yet not decided) and the data of the graph would be catch by reading a .bin file, but this is the first time I deal with binary files so I'm a "little" bit ignorant on how do I proceed.
Before writing the actual software, I'm developing a second one to help me in my process of learning how to deal with binary files. This software has two QTextEdit side-by-side and have a "instant connection" between them (i.e. if one of them is edited, the other immediately should change base on what is written in the changed QTextEdit). But one of the QTextEdit is supposed to be connected with a .bin file and originally show what is written in the file in binary code (so one of the QTextEdit will show only a set of 0000 and 1111 and so on), while the other should be its translator, i.e. should show the binary code of the first QTextEdit in ASCII characters.
Now I already noticed that to work in this project I will use QDataStream and QFile. But the problem is that I'm not familiar with QDataStream::readBytes() and readRayData(), and nether with the write functions. So for example in the beginning, when the QFile is opened and should show in on of the QTextEdit the bin data contained in the .bin file, I don't know which function to use in the place of QTextStream::readAll().
Could somebody help me in this project? Which function do I use to read a binary code and show them in ASCII (e.g. 01000001 shows 65), how can I give a readAll() and how can I write an ASCII character and the software translate it to binary? And how can I make sure that the user will only write "0"s or "1"s in the QTextEdit for binary data, calling a warning if the user attempts to write a non-binary caracter? (i.e. try to put an ASCII char)
Thanks!!
Momergil
Note: It's something like this I want to do: http://www.roubaixinteractive.com/Pl...ry_To_Text.asp
Bookmarks