1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
|
int address = 57856;
int i=0;
stringstream ss4;
ss4 << hex << address;
string result = ss4.str();
unsigned int a1 = strtoul(("1"+result.substr(0, 1)).c_str(), NULL, 16);
unsigned int a2 = strtoul(("1"+result.substr(1, 1)).c_str(), NULL, 16);
unsigned int a3 = strtoul(("1"+result.substr(2, 1)).c_str(), NULL, 16);
unsigned int a4 = strtoul(("1"+result.substr(3, 1)).c_str(), NULL, 16);
unsigned char Wrisultato[] = {0x8b, a1, a2, a3, a4, 0x10, 0x28};
write(fd,(char*)Wrisultato,sizeof(Wrisultato));
|