关于sprintf和sscanf的一个例子

 

 他们就像是兄弟,还是可逆的。

//sprintf for (int n = 0; n < i; n++) { sprintf(sciphertext_char,"%02X", ciphertext_char[n] & 0x00FF); ciphertext.append(sciphertext_char); } //sscanf #define MAXLEN 100; unsigned char O[MAXLEN]; unsigned char I[]="0123456789ABCDEF"; int i,L,N; L=strlen(I); N=__min(L/2,MAXLEN); for (i=0;i<N;i++) sscanf(I+i*2,"%02x",&O[i]); 

 

你可能感兴趣的:(ini)