代码:
#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)
当我从终端运行命令时,它运行良好。我想知道出了什么问题。