我有以下字節數組,我正在鑄造到下面的結構: **我知道它不是在這裏適當的格式"0x80",
等,但在我的代碼它是。字節數組結構 - 如何訪問結構成員
unsigned char ReadBuffer[512] = { 80 00 00 00 50 00 00 00 01 00 40 00 00 00 01 00 00 00 00 00 00 00 00 00 FF F2 00 00 00 00 00 00 40 00 00 00 00 00 00 00 00 00 30 0F 00 00 00 00 00 00 30 0F 00 00 00 00 00 00 30 0F 00 00 00 00 33 20 C8 00 00 00 0C 42 E0 2A 0F 9F B9 00 00 FF}
typedef struct MFT_ATTRIBUTE {
DWORD dwType;
DWORD dwFullLength;
BYTE uchNonResFlag;
BYTE uchNameLength;
WORD wNameOffset;
WORD wFlags;
WORD wID;
LONG n64StartVCN;
LONG n64EndVCN;
WORD wDatarunOffset;
WORD wCompressionSize;
BYTE uchPadding[4];
LONGLONG n64AllocSize;
LONGLONG n64RealSize;
LONGLONG n64StreamSize;
} MFT_ATTRIBUTE, *P_MFT_ATTRIBUTE;
MFT_ATTRIBUTE* mft_attribute = (MFT_ATTRIBUTE*)ReadBuffer[0];
當我嘗試打印的成員,由於某種原因,我得到了某種增量值:
printf("%x ",&mft_attribute->dwType);
printf("%x ",&mft_attribute->dwFullLength);
printf("%x ",&mft_attribute->uchNonResFlag);
printf("%x ",&mft_attribute->uchNameLength);
Output:
0x80 0x84 0x88 0x89
有人可以幫我澄清這一點?
你爲什麼不寫'無符號的字符ReadBuffer [512] = {0x80的,爲0x00,0x00時,'等等?你在代碼片段中顯示的內容不會被編譯。 – Wolf