The purpose of this code is to let the user enter a name of a song into a string, which can then be buffered and played into a program called 'mplayer'.
Code:
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
int main(void)
{
int menu, option, playchoice; // for switch case- ignore this.
char song[20]; // string for song name
printf("Which song?");
scanf("%s", &song); // sets song name to 'song'
sprintf("buffer, system(%s)", song);
system("buffer");
sprintf("buffer.mplayer %s", song);
system("pause");
}
I have just selected the bits relating to this code as the other code (switch statements) are not the problem.
This is for a program called 'mplayer'. There are no compiling errors. It just stops responding and Windows closes it. I am new to programming and have had difficulties getting this far.
Thanks for any help!