hi all
i have a binary file. i want to read it by Qfile and then put each Byte of it in a cell of float array.
please help. thanks a lot
hi all
i have a binary file. i want to read it by Qfile and then put each Byte of it in a cell of float array.
please help. thanks a lot
Last edited by Alex22; 14th November 2015 at 17:13.
What have you tried?
ChrisW67, i want like fread command in C++, to read a binary file in Qt and then put each byte in a cell of a char type array and then cast it to float and plot it by qwt. like this code in C:
//open file
FILE *fp;
if ((fp = fopen(path, "rb")) == NULL)
{
perror("Error opening binary file");
return 1;
}
//read from file to memory
fread(&vm.memory, 1, 65536, fp);
fclose(fp);
QFile::read() into an existing char buffer or QByteArray
Alex22 (15th November 2015)
Qt Code:
const int bufferSize = 1024; char buf[bufferSize]; ... qint64 bytesRead = file.read(buf, bufferSize);To copy to clipboard, switch view to plain text mode
Alex22 (17th November 2015)
Bookmarks