#include #include #include #define BUFFERSIZE 1024 int main(int argc, char **argv) { int status = 1; char soundfile[BUFFERSIZE]; char *sound = soundfile; if (argc > 1) { sound = argv[1]; } else { sprintf(soundfile, "%s\\jcomeau.com\\laugh\\laugh.wav", getenv("APPDATA")); } status = sndPlaySound(sound, SND_FILENAME); return !status; /* status is 1 on success, so invert to 0 */ }