|
注册登录,了解更多芯片技术。
您需要 登录 才可以下载或查看,没有账号?立即注册
x
#define USER_READ_DEV "udisk0"//"sd0" "sd1" 其他设备名参考dev_reg.h
#define USER_READ_FILE_NAME "1.txt"//"1.TXT"
#define USER_READ_FILE_BUF_SIZE (512)
void user_file_read_test(void *param)
{
char user_file_path[48] = {0};
const char user_file_name[] = USER_READ_FILE_NAME;
struct __dev *dev = dev_manager_find_spec(USER_READ_DEV, 0);
if(!dev){
printf("dev_manager_find_spec error");
return;
}
sprintf(user_file_path, "%s%s", dev_manager_get_root_path(dev), user_file_name);
printf("read file path=%s",user_file_path);
FILE *fd = fopen(user_file_path, "r");
if (!fd) {
printf("open %s file err!!!\n",user_file_path);
return ;
}
u8 buf[USER_READ_FILE_BUF_SIZE]={0};
u8 len;
len = fread(fd, buf, sizeof(buf));
printf("read file len %d",len);
printf("read file data %s",buf);
fclose(fd);
//sys_hi_timeout_add
//sys_s_hi_timerout_add(NULL,user_file_read_test,1000);
}
|
|