/*******************************************************************
* > File Name: char_test.c
* > Create Time: 2019年12月27日 星期五 16时30分51秒
******************************************************************/
#include <stdio.h>
char SCSIInquiryData[] = {
0x00,// // Peripheral usb_slave Type: direct access usb_slaves 0x05,//
0x80, // Removable: UFD is removable
0x02, // ANSI version
0x02, // Response Data Format: compliance with UFI
// 0x00, // Additional Length (Number of UINT8s following this one): 31, totally 36 UINT8s
0x1F,
0x00, 0x00, 0x00, // reserved
'N', // -- Vender information start
'B', //
'D', //
'V', //
'R', //
'1', //
'2', //
'2', // -- Vend Information end
'H', // -- Production Identification start
'D', //
'A', //
'-', //
'M', //
'S', //
' ', //
' ', //
' ', //
' ', //
' ', //
' ', //
' ', //
' ', //
' ', //
' ', // -- Production Identification end
0x31, // -- Production Revision Level start
0x2e, //
0x30, //
0x30 // -- Production Revision Level end
};
char SCSIInquiryData_MS[] = {
0x00,// // Peripheral usb_slave Type: direct access usb_slaves 0x05,//
0x80, // Removable: UFD is removable
0x02, // ANSI version
0x02, // Response Data Format: compliance with UFI
// 0x00, // Additional Length (Number of UINT8s following this one): 31, totally 36 UINT8s
0x1F,
0x00, 0x00, 0x00, // reserved
'N', // -- Vender information start
'B', //
'D', //
'V', //
'R', //
'1', //
'2', //
'2', // -- Vend Information end
'H', // -- Production Identification start
'D', //
'A', //
'-', //
'M', //
'S', //
' ', //
' ', //
' ', //
' ', //
' ', //
' ', //
' ', //
' ', //
' ', //
' ', // -- Production Identification end
0x31, // -- Production Revision Level start
0x2e, //
0x30, //
0x30 // -- Production Revision Level end
};
char SCSIInquiryData_UPDATE[] = {
0x00,// // Peripheral usb_slave Type: direct access usb_slaves 0x05,//
0x80, // Removable: UFD is removable
0x02, // ANSI version
0x02, // Response Data Format: compliance with UFI
// 0x00, // Additional Length (Number of UINT8s following this one): 31, totally 36 UINT8s
0x1F,
0x00, 0x00, 0x00, // reserved
'N', // -- Vender information start
'B', //
'D', //
'V', //
'R', //
'1', //
'2', //
'2', // -- Vend Information end
'H', // -- Production Identification start
'D', //
'A', //
'-', //
'U', //
'P', //
'D', //
'A', //
'T', //
'E', //
' ', //
' ', //
' ', //
' ', //
' ', //
' ', // -- Production Identification end
0x31, // -- Production Revision Level start
0x2e, //
0x30, //
0x30 // -- Production Revision Level end
};
int main(int argc, char* argv[])
{
int len1 = 0;
len1 = sizeof(SCSIInquiryData)/sizeof(char);
//len1 = sizeof(SCSIInquiryData)/sizeof(SCSIInquiryData[0]);
printf("len1 = %d\n", len1);
int ii = 0;
for(ii = 0; ii < len1; ii ++)
{
printf("%d--[%c]\n", SCSIInquiryData[ii], SCSIInquiryData[ii]);
}
puts("1=============================================================");
for(ii = 0; ii < sizeof(SCSIInquiryData_UPDATE)/sizeof(char); ii ++)
{
printf("%d--[%c]\n", SCSIInquiryData_UPDATE[ii], SCSIInquiryData_UPDATE[ii]);
}
puts("2=============================================================");
for(ii = 0; ii < sizeof(SCSIInquiryData)/sizeof(char); ii ++)
{
SCSIInquiryData[ii] = SCSIInquiryData_UPDATE[ii];
printf("%d--[%c]\n", SCSIInquiryData[ii], SCSIInquiryData[ii]);
}
return 0;
}
C语言 | 获取一个数组的长度
最新推荐文章于 2023-11-18 21:00:38 发布