Want to run a c program from php using exec () function

I am trying to run a single c executable using php exec()

.

If c contains a simple program like print hello

. I use

exec('./print.out')

      

It works fine. But when I need to pass an argument to my c program, I use

exec('./arugment.out -n 1234')

      

He does not work. Can any body tell me how to get through a press release using the exec

to c.

+2


a source to share


1 answer


From looking at the php documentation, it seems to exec

treat arguments a little oddly. You can try doing

exec("./argument.out '-n 1234'")

      



to prevent him from being banished (he usually separates them all in space, which may be what spoiled him).

+4


a source







All Articles