Im aware that the fifo is being read and so cant be written to however I cant work out where or how, I get a bad file descriptor error, in the case of this code it means that nothing is written to the fifo
this is the main method, I have taken out the music functionality and other bits that I dont think have any relevance
//this block gets the directory the user is using for the program
if ((cwd = getenv("HOME")) == NULL) {
~~~~~
}
//create and initialise IPC object
IPC ipc( PATH + "/tmp/fifo");
//checks if args have been put in correctly and this instance is the music
//program or just passing the music a message
if( argc == 2 && ipc.IPCOriginal()){
~~~some music logic~~~
//while music is not over, might want to slow this down later too
while( song.isPlaying() && running){
//some music logic
}
//if this thread is to simply sit and spin then it had better not do too
//mutch too often, this function sleeps for 1 second
sleep( 1);
}
std::cout<< track + " stopped, closing." <<std::endl;
ipc.IPCClose();
return 0;
//in this case the instance of the program is just going to send a message
//and then exit
}elseif( argc == 2 && !ipc.IPCOriginal()){
//sends the message that was in args and exits the program
///FOR NOW SIMPLY KILLS THE PROGRAM
ipc.IPCSend( kill.c_str());
ipc.IPCClose();
return 0;
}else{
//if no argument, or one that is not a recognised command
//is passed to this instande and an original instance is allready running
//then send the kill command to shut the ptogram down
if( !ipc.IPCOriginal()){
ipc.IPCSend( kill.c_str());
//else the program was called with bad arguments or without any
//displaying notes on working commands
}else{
//notify of error
}
ipc.IPCClose();
return 0;
}