原子stm32f4 文件系统fatfs怎么写

原子stm32f4 文件系统fatfs怎么写,第1张

原子stm32f4 文件系统fatfs怎么写

下面是一段测试代码。

test.c

#include <stdio.h >

#include <unistd.h >

static void PrintMessage(int i)

static void GoToSleep(void)

int main(void)

{

int i = 100000

while ( 1 )

{

PrintMessage( i )

GoToSleep()

i -= 1

}

return 0

}

void PrintMessage(int i)

{

char buf[1024]

sprintf(buf,"%d bottles of beer on the wall.\n", i)

printf("%s",buf)

}

static void GoToSleep(void)

{

sleep(3)

}

最有可能是写文件没有成功

另外一个可能是你不小心设置了文件为隐藏,不过可能性很小,除非你调用文件系统函数主动更改过文件属性

FatFS写文件的一般步骤是:

使用f_open函数打开文件,f_lseek函数将文件指针移动到文件尾(可选),f_write文件进行写,f_close关闭并将缓存数据(如果有的话)写入SD卡


欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/bake/11829485.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2023-05-19
下一篇 2023-05-19

发表评论

登录后才能评论

评论列表(0条)

保存