execve to execute a program


 
Thread Tools Search this Thread
Top Forums Programming execve to execute a program
# 1  
Old 07-25-2004
execve to execute a program

I tried using the following code to execute a program but it doesnt seems to be working .. I would like to know whats wrong wit it .


execve("/bin/cat", "words", NULL);
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

Program Does not execute

Hi there, When I am trying to execute any shell script. The shell script only execute line 1 and I notice that the rest o the program was not executed. Please advise. # bash +x vmscript-4.sh Even when I enter this command there is not output. sudo su cd /tmp cp... (2 Replies)
Discussion started by: alvinoo
2 Replies

2. Shell Programming and Scripting

Execute a command after a program was launched

Hi Experts, I am creating a script to monitor a certain applications running in my Unix system. My script order goes this way: df -h /of/a/filesystem tail -5 /path/to/an/application/availability su -c "jsmon pf=(profile of my application) `echo "p"`" usradm #EOF I am... (7 Replies)
Discussion started by: Xworks
7 Replies

3. Ubuntu

I can't execute a C++ program, help!

My professor gave me a code with no errors. When I compile it's fine, it doesn't show any errors, but when I try to execute it shows this: line 3: syntax error near unexpected token '(' line 3: 'int main()' I searched through the Internet but I couldn't find any solution. Please!!!... (1 Reply)
Discussion started by: rosiiieee
1 Replies

4. Shell Programming and Scripting

Execute a C program and retrieve information

Hi I have the following script: #!/bin/sh gcc -o program program.c ./program & PID=$! where i execute a C program and i get its pid. I want to retrieve information about this program (e.g memory consumption) using command top. So far i have: top -d 1.0 -p $PID But i dont know how to... (6 Replies)
Discussion started by: nteath
6 Replies

5. Shell Programming and Scripting

Execute a C program from Shell

Hi I want to create a shell script tha executes a C program and then retrieves information about it. I managed to run the program with: #!/bin/bash gcc -o program program.c ./program Now i want to get the id of the process (pid) Any help would be appreciated, Thank you (18 Replies)
Discussion started by: nteath
18 Replies

6. UNIX for Dummies Questions & Answers

how to execute program without using ./ or sh

Hi, I am a complete newbie for unix. I have just installed mysql on my MAC. I was wondering every time I wanted to use mysql I had to ./mysql or sh mysql everytime on /usr/local/bin/mysql/bin. How can I execute the mysql program without using ./ or sh. I chmod +x already. And what do I have to... (3 Replies)
Discussion started by: noppanit
3 Replies

7. Shell Programming and Scripting

How to execute a program at expect script

what i need is that after passwordless enter another program should execute. I can succeed passwordless login but ı could not execute (./son) program. pls help me (6 Replies)
Discussion started by: fozay
6 Replies

8. Linux

execute a program remotely using putty

hi all. I have a small program on a debian server which i need to execute remotely from a windows machine using putty. when i use putty to execute the program it starts running , but when i close the session the program stops running on the debian server as well. Can anyone guide me how... (4 Replies)
Discussion started by: coolatt
4 Replies

9. UNIX for Dummies Questions & Answers

Script to open program and send/execute command in program

Hi, i want to write a script that executes a program (exec?) . this program then requires a filename as input. how do i give it this input in the script so the program will be complete run and close by the script. e.g. exec prog.exe program then asks for filename "enter filename:"... (1 Reply)
Discussion started by: tuathan
1 Replies

10. Shell Programming and Scripting

how to execute this program?

Filesystem 1024-blocks Free %Used Iused %Iused Mounted on /dev/hd4 32768 16016 52% 2271 14% / /dev/hd2 4587520 1889420 59% 37791 4% /usr /dev/hd9var 65536 12032 82% 518 4% /var /dev/hd3 819200 637832 ... (1 Reply)
Discussion started by: sathyaac
1 Replies
Login or Register to Ask a Question
FEXECVE(3)						     Linux Programmer's Manual							FEXECVE(3)

NAME
fexecve - execute program specified via file descriptor SYNOPSIS
#include <unistd.h> int fexecve(int fd, char *const argv[], char *const envp[]); Feature Test Macro Requirements for glibc (see feature_test_macros(7)): fexecve(): Since glibc 2.10: _XOPEN_SOURCE >= 700 || _POSIX_C_SOURCE >= 200809L Before glibc 2.10: _GNU_SOURCE DESCRIPTION
fexecve() performs the same task as execve(2), with the difference that the file to be executed is specified via a file descriptor, fd, rather than via a pathname. The file descriptor fd must be opened read-only, and the caller must have permission to execute the file that it refers to. RETURN VALUE
A successful call to fexecve() never returns. On error, the function returns, with a result value of -1, and errno is set appropriately. ERRORS
Errors are as for execve(2), with the following additions: EINVAL fd is not a valid file descriptor, or argv is NULL, or envp is NULL. ENOSYS The /proc file system could not be accessed. VERSIONS
fexecve() is implemented since glibc 2.3.2. CONFORMING TO
POSIX.1-2008. This function is not specified in POSIX.1-2001, and is not widely available on other systems. NOTES
On Linux, fexecve() is implemented using the proc(5) file system, so /proc needs to be mounted and available at the time of the call. SEE ALSO
execve(2) COLOPHON
This page is part of release 3.44 of the Linux man-pages project. A description of the project, and information about reporting bugs, can be found at http://www.kernel.org/doc/man-pages/. Linux 2010-09-15 FEXECVE(3)