char* prefix;
char* suffix;
char* wcid;
char* filename;
int i;
prefix = "c":\\T";
suffix = ".wav";
i = 1;
sprintf(wcid,"%d",i);
sprintf(filename,"%s%s%s",prefix,wcid,suffix);
PlaySound(filename);
以上脚本哪里出错?
PlaySound("C:\\T1.wav");这样就可以了,为什么?
最佳答案
你没有给字符指针分配存储空间
char* prefix;
char* suffix;
char* wcid;
char* filename;
int i;
prefix = SysMalloc(30);
suffix = SysMalloc(30);
wcid = SysMalloc(30);
filename = SysMalloc(30);
prefix = "c:\\T";
suffix = ".wav";
i = 1;
sprintf(wcid,"%d",i);
sprintf(filename,"%s%s%s",prefix,wcid,suffix);
PlaySound(filename);
提问者对于答案的评价:
thank you
原创文章,作者:more0621,如若转载,请注明出处:https://www.zhaoplc.com/plc268542.html