Unsolved Splitting a bin file of 10560 bytes
-
-
@Anna_64 What is your question?
-
i want to split a file which looks like
QFile file("C:\Users\Desktop\binfile_enc.bin");
this file is of size 1050.624 bytes
i want to split into 64 chunks please help -
@Anna_64 Read the file into a QByteArray and use https://doc.qt.io/qt-5/qbytearray.html#mid to split it
-
@Anna_64
Please, do not ask the same question in multiple threads.Creating a new topic for a new question is the way it's supposed to be, but you asked this now also in 2 other topics.
-
@jsulm how to show the start and end position
also i need 64 chunks 16416 bytes from my file -
Simply read your chunks with QFile::read(int) and do whatever you want to do with the data afterwards.
-
@Anna_64 said in Splitting a bin file of 10560 bytes:
how to show the start and end position
this is simple math
-
@jsulm
I previously answered this question asked by @Anna_64 in other thread at https://forum.qt.io/topic/100441/issue-reading-from-qserialport/14. -
@jsulm how to read a file in 64 times in qt
-
@Anna_64 Using a for-loop and QFile::read(int) as @Christian-Ehrlicher suggested.
-
@jsulm i have a QByte Array z=y.mid(0,16326);
i want to 64 chunk like this from 16326 how to do that -
@Anna_64
you're either having us on, or you started coding literally last week.In the later case, you should to some tutorial/learning on the basics first.
-
@Anna_64 said in Splitting a bin file of 10560 bytes:
i want to 64 chunk like this from 16326 how to do that
So, you want to divide 16326 into 64 chunks, right?
What would the size of one chink be then? This is now not programming, just simple math.
If you calculated the size of one chunk, you then can have a for-loop (https://en.cppreference.com/w/cpp/language/for) which you execute 64 times and in each iteration read one chunk from the file (using QFile::read(int)). -
yes i calculated size of a chunk it s 16416 now i take it like QByteArray y= iContents.mid(0,16416)
now i need 64 chunk like this
thank u for guiding -
for (int i = 0; i < 64; ++i) { QByteArray y= iContents.mid(i * 16416, 16416); ... }
-
@jsulmthank you
-
@Anna_64 if your issue is solved please don't forget to mark your post as such!. Thanks.