0
代碼:afplay錯誤:AudioFileOpen失敗(-43)
#include<stdio.h>
#include<string.h>
int main (int argc, char *argv[]) {
char folderPath[1024];
int i = 0;
for (i; i < (strlen(argv[0]) - 7); i++) {
folderPath[i] = argv[0][i];
}
printf("Command: afplay %ssong.mp3\n", folderPath);
system("afplay %ssong.mp3", folderPath);
return 0;
}
所有輸出:
Command: afplay /Users/carloabelli/Desktop/FUNNY/song.mp3
Error: AudioFileOpen failed (-43)
當我從終端運行命令它完美。我想知道發生了什麼問題。