1.print
char buffer[22][8] = { 0 }; method1: 为了打印出unsigned char数据所对应的数值,可以将其强制转换成int类型,并做打印输出。 std::cout << "buffer[22][0]: " << std::hex << (int)buffer[22][0] << std::endl; method2: printf("buffer[0]: --- %x --- %d ", (unsigned char)buffer[i][0], i+1);
2. write into file..
//#include <fstream> std::ofstream in;//buffer data to be writen... std::ofstream out;//can data... in.open("in.txt", ios::trunc); out.open("out.txt", ios::trunc); for (int k = 0; k < 8; k++) { out << std::hex << (int)frame.data[k] << " "; } out << " "; //close file. in.close(); out.close();
RE:
1.https://blog.csdn.net/u012273127/article/details/53260156;
END