반응형

 


[소스]

#include <stdio.h>
#include <stdlib.h>

int main(int argc, char *argv[])
{


 int nSendHeadMsgLen;
 int nSendBodyMsgLen = 123;

 char sSendHeadMsg[1024];

 nSendHeadMsgLen = 10;
 memset(sSendHeadMsg, 0x00, sizeof(sSendHeadMsg));
 sprintf(sSendHeadMsg,"%0*d", nSendHeadMsgLen , nSendBodyMsgLen);

 fprintf(stdout, "[%s]\n",  sSendHeadMsg);

}


[실행결과]

[0000000123]

 

 

 

반응형
Posted by 공간사랑
,