错误原因在于sprintf函数的第一个参数需要是char型指针,access和system函数同理,网上很多代码将第一个参数的类型定义成了unsigned char类型,使用交叉编译时就会报错。
以下为U盘自动升级程序的代码
#include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>
#include <string.h>
unsigned char ch[8] = {'a','b','c','d','e','f','g','h'};
int main(int argc,char **argv)
{
int fd;