可以按照日期创建出文件,但是没有数据写入。
if(Time_10s>10)
{
Time_10s=0;
DHT11_Read_Data(&temperature,&humidity); //温湿度dht11
printf("temp is %d,humi is %d
",temperature,humidity);
}
if(Time_10s>10)
{
Time_10s=0;
sprintf(FileName,"0://%d.%d.%d.txt",calendar.w_year,calendar.w_month,calendar.w_date);// 20170728.txt
f_open (ftemp,FileName,FA_CREATE_ALWAYS|FA_WRITE); //0x02 FA_WRITE
f_close(ftemp);
sprintf(Datestream,"%d, %d, temperature is %d, humidity is %d;
",calendar.hour,calendar.min,temperature,humidity);
f_open (ftemp,FileName,FA_WRITE);
f_lseek(ftemp,ftemp->fsize);
f_write(ftemp,Datestream,strlen(Datestream),&bw);
f_close(ftemp);
}
}
}
一周热门 更多>