snprintf(목적 버퍼, 복사할 사이즈, 포맷, 아규먼트)
char source[100]="abcdef";
char dest[100];
strncpy(dest, source, 4); // 4 byte copy (4 char)
0000: 61 62 63 64 E0 F7 8C 23 30 F8 8C 23 00 2C 6C 80 abcd...#0..#.,l.
0010: 00 04 00 00 00 04 00 00 00 00 00 00 00 80 01 00 ................
strncpyz(dest, source, 4);// 4 byte copy (3 char + null)
0000: 61 62 63 00 E0 F7 8C 23 30 F8 8C 23 00 DC 6A 80 abc....#0..#..j.
0010: 00 04 00 00 00 04 00 00 00 00 00 00 00 80 01 00 ................
=========================================================================================
_snprintf(char *, size_t, const char *, ...); |
=========================================================================================
=========================================================================================
PHONE MSG
=========================================================================================
GSMHex = "0791280102198188440AA15117180890008401802291018263130A22080B811040309814F761623132B0A1B3AA" //KSC5601
097192 0x30 0x37 0x39 0x31 0x32 0x38 0x30 0x31 0x30 0x32 0x31 0x39 0x38 0x31 0x38 0x38
097211 0x34 0x34 0x30 0x41 0x41 0x31 0x35 0x31 0x31 0x37 0x31 0x38 0x30 0x38 0x39 0x30
097229 0x30 0x30 0x38 0x34 0x30 0x31 0x38 0x30 0x32 0x32 0x39 0x31 0x30 0x31 0x38 0x32
097248 0x36 0x33 0x31 0x33 0x30 0x41 0x32 0x32 0x30 0x38 0x30 0x42 0x38 0x31 0x31 0x30
097266 0x34 0x30 0x33 0x30 0x39 0x38 0x31 0x34 0x46 0x37 0x36 0x31 0x36 0x32 0x33 0x31
097285 0x33 0x32 0x42 0x30 0x41 0x31 0x42 0x33 0x41 0x41
GSM
097315 0x07 0x91 0x28 0x01 0x02 0x19 0x81 0x88 0x44 0x0A 0xA1 0x51 0x17 0x18 0x08 0x90
097333 0x00 0x84 0x01 0x80 0x22 0x91 0x01 0x82 0x63 0x13 0x0A 0x22 0x08 0x0B 0x81 0x10
097352 0x40 0x30 0x98 0x14 0xF7 0x61 0x62 0x31 0x32 0xB0 0xA1 0xB3 0xAA 0x37
해석:
0x07
0x91
SERVICE CENTER: 0x28 0x01 0x02 0x19 0x81 0x88
TP-UDHI: 0x44
ADDRESS: 0x0A 0xA1 0x51 0x17 0x18 0x08 0x90
PROTOCOL ID: 0x00
DCS: 0x84
TIME STAMP: 0x01 0x80 0x22 0x91 0x01 0x82 0x63
DATA LENGTH: 0x13
HEADER LENGTH: 0x0A 0x22 0x08 0x0B 0x81 0x10 0x40 0x30 0x98 0x14 0xF7
DATA: 0x61 0x62 0x31 0x32 0xB0 0xA1 0xB3 0xAA
=========================================================================================
포인터이동
=========================================================================================
char msg[255] = {1,2};
char* pbWalk = msg;
UINT cchUserDataLength = *pbWalk++;
RETAILMSG(1,(_T("KSC5601: len: %d msg: 0x%x pbWalk: 0x%x\r\n"),cchUserDataLength,msg,pbWalk));
KSC5601: len: 1 msg: 0x218cf9fc pbWalk: 0x218cf9fd
'Hello Android' 카테고리의 다른 글
hw_get_module (0) | 2017.03.17 |
---|---|
안드로이드 원격조정 seven-square (0) | 2016.07.12 |
spin_lock_irq 문제 (0) | 2015.09.15 |
complete 함수 (0) | 2015.09.15 |
리눅스에서 쉘 ftp (0) | 2015.08.20 |