473,326 Members | 2,111 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,326 software developers and data experts.

execlp works for other executable but not mine :(

Hi all,
I have written a server & child program both are working fine but when the server tries to execute the child program with the line

execlp("child","child", parameter, NULL );

nothing happens it does not call it, yet if I test the above line by substituting child with a system binary like pwd or ls it calls it without trouble. I have used the command "chmod a+x child" to make child executable but still to run child manually at the command line I must type "./child" (which executes fine when supplied with parameter) I have also tried putting the "./" into the above execlp line and some googling but I am not sure what I should be searching for?

so the problem is this the execlp line above works for other binaries but not mine even after using chmod & manually testing child from the command line.

any ideas, anyone?
Mar 6 '07 #1
6 2800
AdrianH
1,251 Expert 1GB
Hi all,
I have written a server & child program both are working fine but when the server tries to execute the child program with the line

execlp("child","child", parameter, NULL );

nothing happens it does not call it, yet if I test the above line by substituting child with a system binary like pwd or ls it calls it without trouble. I have used the command "chmod a+x child" to make child executable but still to run child manually at the command line I must type "./child" (which executes fine when supplied with parameter) I have also tried putting the "./" into the above execlp line and some googling but I am not sure what I should be searching for?

so the problem is this the execlp line above works for other binaries but not mine even after using chmod & manually testing child from the command line.

any ideas, anyone?
Well, according to here this will cause your parent to be overlaid by the child thus destroying it. What you probably want to use is fork().

However, it should have still executed your child. Find out the errno after the call to determine what went wrong, perror() will actually print out a human readable error, and strerror() can be used to dump the message to a buffer.

Hope this helps.


Adrian
Mar 6 '07 #2
arne
315 Expert 100+
Hi all,
I have written a server & child program both are working fine but when the server tries to execute the child program with the line

execlp("child","child", parameter, NULL );

nothing happens it does not call it, yet if I test the above line by substituting child with a system binary like pwd or ls it calls it without trouble. I have used the command "chmod a+x child" to make child executable but still to run child manually at the command line I must type "./child" (which executes fine when supplied with parameter) I have also tried putting the "./" into the above execlp line and some googling but I am not sure what I should be searching for?

so the problem is this the execlp line above works for other binaries but not mine even after using chmod & manually testing child from the command line.

any ideas, anyone?

You will certainly need the './', since execlp will not find your 'child' program otherwise (except you have the local dir in PATH variable ... ). I checked with 2 small test programs and it worked for me ... looking at the errno after the execlp may give a clue.
Mar 6 '07 #3
I have it sussed out it was errno 29 an illegal seek and turned out to be a path name problem in the child proccess..

incidently its not important but how do I make my programs executable without using the preceeding dot slash ?
Mar 6 '07 #4
Thank for the help guys!!! much appreciated
Mar 6 '07 #5
AdrianH
1,251 Expert 1GB
I have it sussed out it was errno 29 an illegal seek and turned out to be a path name problem in the child proccess..

incidently its not important but how do I make my programs executable without using the preceeding dot slash ?
Put the executable in the path, or modify the path to point at the directory of the executable. It is not recommended to make '.' an executable directory for security reasons though. If you do, be careful.


Adrian
Mar 6 '07 #6
OK gotcha thanks for all the help!!!
Mar 6 '07 #7

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Melissa Wallis | last post by:
In a Python script I start a number of C++ processes using os.execlp. Most of these processes output messages for debugging purposes at this time. The problem I am having is that by starting 4 or...
4
by: Paul Nilsson | last post by:
Hi, Does anyone know how to redirect text output when issuing a system or an execlp call? I have a GUI that insists on opening up a console whenever I give a system function call, and I would...
1
by: Walter Cohen | last post by:
I know nothing about Oracle forms. A friend of mine said that his firm no longer has the source for many of their applications written using Oracle forms, they only have the executable. Is it...
6
by: Erik S. Bartul | last post by:
as i understand if, the first argument of execlp() is a null terminated string containing the path of the command which to be executed. the second argument is an array of pointers to null...
28
by: Tim Daneliuk | last post by:
I have a program wherein I want one behavior when a file is set as executable and a different behavior if it is not. Is there a simple way to determine whether a given named file is executable...
2
by: Cindy | last post by:
I have an Access 2003 database with a query that works fine on my PC but does not work on another PC. My PC has older versions of Access installed as well as 2003 - the other PC only has Access...
6
by: druidamix | last post by:
I'm trying to make a gui for an application, but it not run. i'm trying to send the output of execlp to pipe and read from his father. but i don't obtain results. Any advince? Thank you. ...
1
by: Jerome | last post by:
Hi all, I've made a .NET wrapper of a C++ toolkit using MC++ (perhaps I should now take a look to C++/CLI). The 32 bits version works fine on Win32 and 64 bits version works fine on Win64 .......
2
by: manontheedge | last post by:
I'm trying to write a program in C on Linux where the child processes get their process images replaced. I have in my code, a few child processes that I forked from a single parent process. I'm...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.