sprintf-Objective C
I have this code.
sprintf((char *)pD开发者_Go百科ata,"%c%02X%c%02X%
02X",ASCII_STX,m_uSessionId,m_chSequenceChar,m_nMessageId,m_uVersion);
NSLog("%@",pData);
But its not printing
me the contents
of pData. Tried with %d
as format specifier.
Maybe you'll use the Obj-C method?
NSString *pData = [NSString stringWithFormat:@"%c%02X%c%02X%02X", ASCII_STX, m_uSessionId, m_chSequenceChar, m_nMessageId, m_uVersion];
NSLog(@"%@",pData);
Try the following. Perhaps it is not recognizing pData as a string:
NSLog( @"%s", pData );
精彩评论