您好,欢迎来到三六零分类信息网!老站,搜索引擎当天收录,欢迎发信息

snprintf() 请问请问

2025/5/14 17:17:16发布22次查看
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
c++ php
------解决方案--------------------
snprintf用法
header file
stdio.h
category
memory and string manipulation routines
prototype
int snprintf(char* buffer, size_t nsize, const char* fmt, ...);
int snwprintf(wchar_t* buffer, size_t nsize, const wchar_t* fmt, ...);
description
sends formatted output to a buffer of a maximum length specified by nsize.
if the number of bytes to output is:
nsize, then only nsize characters are written, with no terminating 慭0?character.
if nsize is 0, then the string will not be written to (and may be null).
return value
number of bytes output, or, if nsize is 0, the number of bytes needed, not including the terminating 慭0?character.

你想倒车回去好像不太容易,先不说超出长度会截取的问题
$a=123;
$b=4567;
$c=$a.$b;
光给你一个$c你是无法一次确定$a的内容,即使你知道规则
------解决方案--------------------
1、mac地址是6个字节,可用12个十六进制数表示
2、不知道你为什么能表示成16个十六进制数?
3、你的 strmac 串已然是 mac地址表示了,不知道你还要处理成什么要的
该用户其它信息

VIP推荐

免费发布信息,免费发布B2B信息网站平台 - 三六零分类信息网 沪ICP备09012988号-2
企业名录 Product