下面是一段测试代码。
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卡
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)