sscanf到uint8在vxWorks平台中不起作用

问题描述

无论使用哪种最新,最好的编译器,我的代码都可以在Windows Visual Studio平台中完美运行。

import React,{useState,useEffect,useRef} from 'react';

export default App = () => {
  const [height,setHeight] = useState(0);
  const elementRef = useRef(null);

  useEffect(() => {
    setHeight(elementRef.current.clientHeight);
  },[]); //empty dependency array so it only runs once at render

  return (
    <div ref={elementRef}>
      {height}
    </div>
  )
}

但是,在带有c ++ 98的vxWorks 6.9上,这将导致一个空字节数组。我在我的代码库中看到了类似方法的代码,它们使用格式化程序void ConvertStringToMacAddress(std::string mac_addr,uint8_t mac[]) { // sscanf_s in windows sscanf(mac_addr.c_str(),"%02hhu:%02hhu:%02hhu:%02hhu:%02hhu:%02hhu",&mac[0],&mac[1],&mac[2],&mac[3],&mac[4],&mac[5] ); printf("converted mac is 0x%x 0x%x 0x%x 0x%x 0x%x 0x%x\n",mac[0],mac[1],mac[2],mac[3],mac[4],mac[5]); } 而不是%02X。但是,这会导致我在Windows中的构建崩溃。....不确定什么地方出错或该怎么办。

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)

相关问答

错误1:Request method ‘DELETE‘ not supported 错误还原:...
错误1:启动docker镜像时报错:Error response from daemon:...
错误1:private field ‘xxx‘ is never assigned 按Alt...
报错如下,通过源不能下载,最后警告pip需升级版本 Requirem...