ホームページ >バックエンド開発 >PHPチュートリアル >snprintf() 请问请问
snprintf() 请教请教
unsigned char *mac = (unsigned char *)&macAddr;
snprintf(strMac, 33, "%02X%02X%02X%02X%02X%02X%02X%02X", mac[0], mac[1], mac[2], mac[3], mac[4], mac[5], mac[6], mac[7]);
这是C++里面的处理方法
现在知道strMac 怎么用php 获取到mac
<br />snprintf用法<br /><br />Header File<br /><br />stdio.h<br /><br />Category<br /><br />Memory and String Manipulation Routines<br /><br />Prototype<br /><br />int snprintf(char* buffer, size_t nsize, const char* fmt, ...);<br /><br />int snwprintf(wchar_t* buffer, size_t nsize, const wchar_t* fmt, ...);<br /><br />Description<br /><br />Sends formatted output to a buffer of a maximum length specified by nsize.<br /><br />If the number of bytes to output is:<br /><br />< nsize, then all of the characters have been written, including the terminating 慭0?character.<br /> == nsize, then nsize characters are written, with no terminating 慭0?character.<br /><br />> nsize, then <span style="color: #FF0000;">only nsize characters are written</span>, with no terminating 慭0?character.<br />If nsize is 0, then the string will not be written to (and may be NULL).<br /><br />Return Value<br /><br />Number of bytes output, or, if nsize is 0, the number of bytes needed, not including the terminating 慭0?character.<br />