f_mount(0,*fs)移植不对吧,应该有三个参数的

2019-07-20 04:12发布

[mw_shl_code=c,true] // Register a work area for logical drive 0 f_mount(0,&fs,1); res=f_mkdir("0ATA");//在SD卡里面新建文件夹 // Open source file res = f_open(&fsrc, "srcfile.dat", FA_OPEN_EXISTING | FA_READ); if (res) die(res); // Create destination file res = f_open(&fdst, "dstfile.dat", FA_CREATE_ALWAYS | FA_WRITE); if (res) die(res); // Copy source to destination for (;;) { res = f_read(&fsrc, buffer, sizeof(buffer), &br); if (res || br == 0) break; // error or eof res = f_write(&fdst, buffer, br, &bw); if (res || bw < br) break; // error or disk full } // Close all files f_close(&fsrc); f_close(&fdst); // Unregister a work area before discard it f_mount(0, NULL,1);[/mw_shl_code] [mw_shl_code=c,true]以下是f_mount定义[/mw_shl_code] [mw_shl_code=c,true]/*-----------------------------------------------------------------------*/ /* Mount/Unmount a Logical Drive */ /*-----------------------------------------------------------------------*/ FRESULT f_mount ( FATFS* fs, /* Pointer to the file system object (NULL:unmount)*/ const TCHAR* path, /* Logical drive number to be mounted/unmounted */ BYTE opt /* 0o not mount (delayed mount), 1:Mount immediately */ )[/mw_shl_code]
我想实现创建TXT文件,但f_mount(0,*fs)f_mount(0, NULL)总有errors.
查看定义后,发现有f_mount3个参数。
于是我把f_mount(0,*fs)改成了f_mount(0,&fs,1);
f_mount(0, NULL)改成了f_mount(0, NULL,1);

你们移植时有遇到过此情况?

友情提示: 此问题已得到解决,问题已经关闭,关闭后问题禁止继续编辑,回答。
5条回答
daska110
2019-07-20 13:11
[mw_shl_code=c,true]查了下F103的定义,是两个变量[/mw_shl_code] [mw_shl_code=c,true]FRESULT f_mount ( BYTE vol, /* Logical drive number to be mounted/unmounted */ FATFS *fs /* Pointer to new file system object (NULL for unmount)*/ )[/mw_shl_code] 而F407的定义,是3个变量
[mw_shl_code=c,true]FRESULT f_mount ( FATFS* fs, /* Pointer to the file system object (NULL:unmount)*/ const TCHAR* path, /* Logical drive number to be mounted/unmounted */ BYTE opt /* 0o not mount (delayed mount), 1:Mount immediately */ )[/mw_shl_code] 那请问F407的3个变量怎么写呢?

一周热门 更多>