当前位置: 技术问答>linux和unix
求助:前台与后台运行的区别
来源: 互联网 发布时间:2016-10-09
本文导语: 写了一个小程序,里面使用system调用调用了mplayer.前台运行没有问题,后台运行有问题 出问题信息如下: MPlayer SVN-r1.0~rc3+svn20090426-4.4.3 (C) 2000-2009 MPlayer Team mplayer: could not connect to socket mplayer: No such file or dir...
写了一个小程序,里面使用system调用调用了mplayer.前台运行没有问题,后台运行有问题
出问题信息如下:
MPlayer SVN-r1.0~rc3+svn20090426-4.4.3 (C) 2000-2009 MPlayer Team
mplayer: could not connect to socket
mplayer: No such file or directory
Failed to open LIRC support. You will not be able to use your remote control.
哪位大牛能够帮忙讲讲这个前台和后台运行的具体区别?貌似后台运行当前路径已经改变了,找不到音频文件了。还望大牛指点指点
所用代码,非C++,只是不小心用了点C++语言关键字:
出问题信息如下:
MPlayer SVN-r1.0~rc3+svn20090426-4.4.3 (C) 2000-2009 MPlayer Team
mplayer: could not connect to socket
mplayer: No such file or directory
Failed to open LIRC support. You will not be able to use your remote control.
哪位大牛能够帮忙讲讲这个前台和后台运行的具体区别?貌似后台运行当前路径已经改变了,找不到音频文件了。还望大牛指点指点
所用代码,非C++,只是不小心用了点C++语言关键字:
#include
#include
#include
#include
#include
#include
#include
#define MAX 3
#define SEC
using namespace std;
struct itimerval new_timer;
long n_sec,n_usecs;
void shangke(int);
void xiake(int sig)
{
signal(14,shangke);
/*设置新时钟 */
n_sec = 10*60;
n_usecs = 0;
new_timer.it_interval.tv_sec = n_sec;
new_timer.it_interval.tv_usec = n_usecs;
new_timer.it_value.tv_sec = n_sec;
new_timer.it_value.tv_usec = n_usecs;
setitimer(ITIMER_REAL,&new_timer,NULL);
system("/usr/bin/mplayer xk.mp3");
}
void shangke(int sig)
{
signal(14,xiake);
cout