【发布时间】:2017-11-25 20:16:10
【问题描述】:
我正在为 stm32f4 上的 fatfs 苦苦挣扎。没问题我可以挂载,创建文件并通过:char my_data[]="hello world" 在其上写入,并且在 Windows 文件中正常显示,但是当我尝试使用代码作为记录器时:
float bmp180Pressure=1000.1;
char presur_1[6];//bufor znakow do konwersji
sprintf(presur_1,"%0.1f",bmp180Pressure);
char new_line[]="\n\r";
if(f_mount(&myFat, SDPath, 1)== FR_OK)
{
f_open(&myFile, "dane.txt", FA_READ|FA_WRITE);
f_lseek(&myFile, f_size(&myFile));//sets end of data
f_write(&myFile, presur_1, 6, &byteCount);
f_write(&myFile, new_line,4, &byteCount);
f_close(&myFile);
HAL_GPIO_TogglePin(GPIOD, GPIO_PIN_15);
}
当我从计算机读取时,我有:top : notepad ++ buttom :windows notepad
【问题讨论】: