stm 32 sprintf问题
arm杀手 2017-02-24 04:46:16 stm32 使用sprintf函数
void name_creat_txt(char *name,u8 year,u8 mouth,u8 day,u8 hour,u8 min,u8 second )
{
sprintf (name, "0:\%04x%02x%02x%02x%02x%02x.txt", year,mouth,day,hour,min,second);
}
void main()
{
char *text_name;
ReadTime[7]={ox17,0x02,0x21,0x11,0x23,0x20,0x02};
text_name=(u8 *)mymalloc(SRAMEX,1024); //给指针分配外部地址
name_creat_txt( text_name,ReadTime[0],ReadTime[1],ReadTime[2],ReadTimep[3,ReadTime[4],ReadTime[5],ReadTime[6]);
myfree(SRAMEX,text_name);//释放内存
}
这样使用 指针的方式一直不对,当我把name和text_name改为数组格式以后,就可以了,不明白哪里有问题