Skip to content
  • 0 Votes
    7 Posts
    557 Views
    M

    @Christian-Ehrlicher it's printed

  • 0 Votes
    43 Posts
    10k Views
    R

    @mranger90 said in Save QImage from BYTE buffer segfaults ?:

    try:
    BYTE *buf = new BYTE[imWidth * imHeight];

    So the issue turned out to be with the device itself. Changing the code as above and replacing the device solved the issue. Thanks.

  • 0 Votes
    11 Posts
    6k Views
    JKSHJ

    @TomHoe said in Int16 to QByteArray:

    didn't knew that '!' is the same as 0x21..

    See http://www.ascii-code.com/

    '!' == 33 == 0x21 == 0b00100001

    @TomHoe said in Int16 to QByteArray:

    Is there a way to rewrite it to regular hex codes ? Or does every controller understand this notation ?

    Again, '!' == 33 == 0x21 == 0b00100001

    Those are different ways of displaying the same bytes. The controller does not see any "hex" or "notation"; it only sees the sequence of 0's and 1's.

    I recommend you learn about how bits/bytes are stored in computer memory: http://statmath.wu.ac.at/courses/data-analysis/itdtHTML/node55.html

  • 0 Votes
    2 Posts
    2k Views
    A

    I am not sure I completely understand the problem since
    I do not see any structure in your read/write code.

    But normal way to deal with structures (the same as with classes)
    is to write/read every member separate in their natural form with provided by QDataStream functionality.
    And you certainly need to know type of the data written to the file to read it properly.
    Your problem (as far as I can understand) is related to using wrong function to read integer data,
    cause you read it as char data,