Can you pass a QTextStream as a function parameter?
-
Hello,
I am trying to pass a QTextStream that contains IntelHex data to a function so I can process the stream into the proper order, can QTextStream simply be passed as a function parameter or am I going to have to write it to a file and then pass the file location?
-
Why not just try it?
You can pass it as Pointer or Reference as you like. -
@amanill said in Can you pass a QTextStream as a function parameter?:
I am trying to pass a QTextStream that contains IntelHex data
I'm very suspicious about that, QTextStream deals with characters and hex numbers should be in the 0xxxx form.
If you need to convert little endian to host, this is the wrong way to go.
Look at QDataStream and the setByteOrder() method instead. -
@mpergand if the op means https://en.wikipedia.org/wiki/Intel_HEX then QTextStream is indeed correct.
otherwise you are right.
-
Then you should read them via QFile into a QByteArray, do your processing and save the result back into a new QFile.