#include <iostream>
#include <stdio.h>
#include <QCoreApplication>
int main(int argc, char *argv[])
{
unsigned int i;
typedef struct
{
quint16 response_id;
quint32 status_change_id;
bool result_code; // true if sucessful, false otherwise
quint8 reserved[3]; /* Set to 0 */
} receipt_data_type;
receipt_data_type *receipt = new receipt_data_type;
receipt->response_id = 0x0812;
receipt->status_change_id = 1;
receipt->result_code = true;
receipt->reserved[0] = 0;
receipt->reserved[1] = 0;
receipt->reserved[2] = 0;
char * p = (char *) receipt;
for (i=0; i < sizeof(receipt_data_type); i++) {
printf("%02X\r\n", *p++);
}
printf("\r\nAll members of receipt (total size:%d ) \r\n", sizeof(receipt_data_type) );
printf("response_id: %02X (size: %d )\r\n",receipt->response_id, sizeof(receipt->response_id) );
printf("status_change_id: %02X (size: %d )\r\n",receipt->status_change_id, sizeof(receipt->status_change_id));
printf("result_code: %02X (size: %d )\r\n",receipt->result_code, sizeof(receipt->result_code));
printf("reserved[0]: %02X\r\n",receipt->reserved[0]);
printf("reserved[1]: %02X\r\n",receipt->reserved[1]);
printf("reserved[2]: %02X\r\n",receipt->reserved[2]);
delete receipt;
return 0;
}
#include <iostream>
#include <stdio.h>
#include <QCoreApplication>
int main(int argc, char *argv[])
{
QCoreApplication app(argc, argv);
unsigned int i;
typedef struct
{
quint16 response_id;
quint32 status_change_id;
bool result_code; // true if sucessful, false otherwise
quint8 reserved[3]; /* Set to 0 */
} receipt_data_type;
receipt_data_type *receipt = new receipt_data_type;
receipt->response_id = 0x0812;
receipt->status_change_id = 1;
receipt->result_code = true;
receipt->reserved[0] = 0;
receipt->reserved[1] = 0;
receipt->reserved[2] = 0;
char * p = (char *) receipt;
for (i=0; i < sizeof(receipt_data_type); i++) {
printf("%02X\r\n", *p++);
}
printf("\r\nAll members of receipt (total size:%d ) \r\n", sizeof(receipt_data_type) );
printf("response_id: %02X (size: %d )\r\n",receipt->response_id, sizeof(receipt->response_id) );
printf("status_change_id: %02X (size: %d )\r\n",receipt->status_change_id, sizeof(receipt->status_change_id));
printf("result_code: %02X (size: %d )\r\n",receipt->result_code, sizeof(receipt->result_code));
printf("reserved[0]: %02X\r\n",receipt->reserved[0]);
printf("reserved[1]: %02X\r\n",receipt->reserved[1]);
printf("reserved[2]: %02X\r\n",receipt->reserved[2]);
delete receipt;
return 0;
}
To copy to clipboard, switch view to plain text mode
Bookmarks