开发者

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 );
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜