Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

sprintf-Objective C

Tags:

objective-c

I have this code.

    sprintf((char *)pData,"%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.

like image 297
Angus Avatar asked May 04 '11 14:05

Angus


1 Answers

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);
like image 122
akashivskyy Avatar answered Nov 08 '22 06:11

akashivskyy