Я думаю, что, как вы сказали, и проблема, и это PlayDateOfExam, который удивляет меня, так как я вызываю эту функцию во всем своем коде.
Код функции:
char* PlayDateOfExam(int option)
{
char* WaveFileName;
if (option==1)
{
int k=atoi(Global_Input.day);
if (atoi(Global_Input.day)<10)
{
int day=atoi(Global_Input.day);
day=day % 10;
char* day_s=(char*)malloc(sizeof(char)*2);
_itoa(day,day_s,10);
WaveFileName=(char*)malloc(sizeof("\\LowLevel_ASR\\Wave Files\\Grades Files\\"));
strcpy(WaveFileName,"\\LowLevel_ASR\\Wave Files\\Grades Files\\");
strcat(WaveFileName,day_s);
return (WaveFileName);
}
else
{
WaveFileName=(char*)malloc(sizeof("\\LowLevel_ASR\\Wave Files\\Grades Files\\"));
strcpy(WaveFileName,"\\LowLevel_ASR\\Wave Files\\Grades Files\\");
strcat(WaveFileName,Global_Input.day);
return (WaveFileName);
}
}
else if (option==2)
{
int k=atoi(Global_Input.month);
if (atoi(Global_Input.month)<10)
{
int month=atoi(Global_Input.month);
month=month % 10;
char* month_s=(char*)malloc(sizeof(char)*2);
_itoa(month,month_s,10);
WaveFileName=(char*)malloc(sizeof("\\LowLevel_ASR\\Wave Files\\Exams Dates Files\\"));
strcpy(WaveFileName,"\\LowLevel_ASR\\Wave Files\\Exams Dates Files\\");
strcat(WaveFileName,month_s);
return (WaveFileName);
}
else
{
WaveFileName=(char*)malloc(sizeof("\\LowLevel_ASR\\Wave Files\\Exams Dates Files\\"));
strcpy(WaveFileName,"\\LowLevel_ASR\\Wave Files\\Exams Dates Files\\");
strcat(WaveFileName,Global_Input.month);
return (WaveFileName);
}
}
else if (option==3)
{
WaveFileName=(char*)malloc(sizeof("\\LowLevel_ASR\\Wave Files\\Exams Dates Files\\"));
strcpy(WaveFileName,"\\LowLevel_ASR\\Wave Files\\Exams Dates Files\\");
strcat(WaveFileName,"2000+");
return(WaveFileName);
}
else if (option==4)
{
int k=atoi(Global_Input.hour);
if (atoi(Global_Input.hour)<10)
{
int hour=atoi(Global_Input.hour);
hour=hour % 10;
char* hour_s=(char*)malloc(sizeof(char)*2);
_itoa(hour,hour_s,10);
WaveFileName=(char*)malloc(sizeof("\\LowLevel_ASR\\Wave Files\\Grades Files\\"));
strcpy(WaveFileName,"\\LowLevel_ASR\\Wave Files\\Grades Files\\");
strcat(WaveFileName,hour_s);
return (WaveFileName);
}
else
{
WaveFileName=(char*)malloc(sizeof("\\LowLevel_ASR\\Wave Files\\Grades Files\\"));
strcpy(WaveFileName,"\\LowLevel_ASR\\Wave Files\\Grades Files\\");
strcat(WaveFileName,Global_Input.hour);
return (WaveFileName);
}
}
else if (option==5)
{
int k=atoi(Global_Input.minute);
if (atoi(Global_Input.minute)<10)
{
int minute=atoi(Global_Input.minute);
minute=minute % 10;
char* minute_s=(char*)malloc(sizeof(char)*2);
_itoa(minute,minute_s,10);
WaveFileName=(char*)malloc(sizeof("\\LowLevel_ASR\\Wave Files\\Grades Files\\"));
strcpy(WaveFileName,"\\LowLevel_ASR\\Wave Files\\Grades Files\\");
strcat(WaveFileName,minute_s);
return (WaveFileName);
}
else
{
WaveFileName=(char*)malloc(sizeof("\\LowLevel_ASR\\Wave Files\\Grades Files\\"));
strcpy(WaveFileName,"\\LowLevel_ASR\\Wave Files\\Grades Files\\");
strcat(WaveFileName,Global_Input.minute);
return (WaveFileName);
}
}
else if (option==6)
{
WaveFileName=(char*)malloc(sizeof("\\LowLevel_ASR\\Wave Files\\Exam Locations Files\\"));
strcpy(WaveFileName,"\\LowLevel_ASR\\Wave Files\\Exam Locations Files\\");
strcat(WaveFileName,Global_Input.class_location);
return (WaveFileName);
}
else if (option==7)
{
WaveFileName=(char*)malloc(sizeof("\\LowLevel_ASR\\Wave Files\\Exam Locations Files\\"));
strcpy(WaveFileName,"\\LowLevel_ASR\\Wave Files\\Exam Locations Files\\");
strcat(WaveFileName,Global_Input.class_number);
return (WaveFileName);
}
return ("Error");
}
Вызов функции:
sndPlaySound (PlayDateOfExam (4), SND_SYNC);
который написан в потоке, который работает.
Я не знаю, почему в этом сегменте кода происходит сбой