Click to See Complete Forum and Search --> : systemcall in c++?


harald bachl
12-03-2002, 04:37 AM
I need the systemcall system( "cdrecord -eject dev=i,j,0" ). Do anybody know how I can get the possible parameters i and j? If I take system("cdrecord -scanbus") I only get the information on the console but I need the parameters in my c++-program because the devices can be different! Can somebody help me?

truls
12-03-2002, 04:45 AM
Send the result of the command to a file, then open and parse the file. In other words do system("cdrecord -scanbus > resultfile"). Then open and parse the resulting resultfile file.

clark kent
12-03-2002, 05:11 AM
build your system call string.

what i mean is use strcat to build which devices you want. so accept these devices from the command line. so for example do:

cdrecordcode -dev i j k l

and in your code build the string into what you want, then pass this variable into the system call.

hope thats clear. hope i understood your question

binaryDigit
12-03-2002, 09:47 AM
another way of doing it is to use:
execl()
execlp()
execle()
execv()
execvp()


execlp("some_prog", "some_prog", "some_arg", 0);


for more info:

man execl

majidpics
12-04-2002, 08:48 PM
Originally posted by clark kent
build your system call string.

what i mean is use strcat to build which devices you want. so accept these devices from the command line. so for example do:

cdrecordcode -dev i j k l

and in your code build the string into what you want, then pass this variable into the system call.

hope thats clear. hope i understood your question







I read your reply, you poited out the thing which i want to know
in detail to solve a problem. can you tell me the above scenario in more detail, i mean how to accept the devices from the command line.......