Hi again Now I want to make a program that will execute the programs with exec, asking the user if he wants the program to run in background or foreground.
Problem is, it will only execute 1 program. If i try to write ./execute /bin/ls /bin/ls only once will be shown. What's worse, when I try to debug it with ddd, ddd will also crash with a segmentation fault (this happens on foreground code).
Edit: related topics below my post may have given me the answer: is it because when you call exec(), the code of my program won't execute any more?
Last edited by lamachejo; 12-12-2011 at 10:39 AM..
hi there,
i was reading about the exec() function. and if i m not wrong, exec() kills your present process and starts a new process in its place. the process id remains the same.
then it says if exec is successful the text data and stack are overlayed by new file! -
i dont get this part "only... (2 Replies)
Hi,
Ho do I differentiate system call from library call?
for example if I am using chmod , how do I find out if it is a system call or library call?
Thanks
Muru (2 Replies)
Hi ,
Can anybody name any System Function in C/C++ for Sun-Solaris (unix) platform which can serve the alternative of execl() system function.
Actually I am calling a fork-execl() pair and then making an interprocess communication between these two(parent-child process). But the problem is... (3 Replies)
I am new in Perl.
I am working in simple script and the varibles are working well outside the exec or system command.
but they don't work as parameters to exec or system command.
The script is attached.
please help. (8 Replies)
Hi,
I have to run two commands one after another from a c program. How can i do this with exec system calls. i tried giving them as argument to execv but it is not working.please help
thanks (3 Replies)
I have a cgi script which is called after certain time interval, which has this:
system ("ls -l /tmp/cgic* | grep -v \"cgicsave.env\" | awk '{print $5}'");
During the execution of this script,the output is 0 sometimes. But due to this the system call is not working at all and doesnt o/p... (2 Replies)
hi everyone
i wrote a system call and compiled the kernel succesfully...
my system call is in a file in the kernel folder named my_syscall1.c (kernel/my_syscall1.c)
the header file for this system call i added it in the folder include like this include/my_syscall1/my_syscall1.h
my problem is... (2 Replies)
Discussion started by: demis87
2 Replies
LEARN ABOUT PHP
pdo.exec
PDO.EXEC(3) 1 PDO.EXEC(3)PDO ::exec - Execute an SQL statement and return the number of affected rows
SYNOPSIS
public int PDO::exec (string $statement)
DESCRIPTION PDO.exec(3) executes an SQL statement in a single function call, returning the number of rows affected by the statement.
PDO.exec(3) does not return results from a SELECT statement. For a SELECT statement that you only need to issue once during your program,
consider issuing PDO.query(3). For a statement that you need to issue multiple times, prepare a PDOStatement object with PDO.prepare(3) and
issue the statement with PDOStatement.execute(3).
PARAMETERS
o $statement
- The SQL statement to prepare and execute. Data inside the query should be properly escaped.
RETURN VALUES PDO.exec(3) returns the number of rows that were modified or deleted by the SQL statement you issued. If no rows were affected, PDO.exec(3)
returns 0.
Warning
This function may return Boolean FALSE, but may also return a non-Boolean value which evaluates to FALSE. Please read the section on
Booleans for more information. Use the === operator for testing the return value of this function.
The following example incorrectly relies on the return value of PDO.exec(3), wherein a statement that affected 0 rows results in a call to
die(3):
<?php
$db->exec() or die(print_r($db->errorInfo(), true));
?>
EXAMPLES
Example #1
Issuing a DELETE statement
Count the number of rows deleted by a DELETE statement with no WHERE clause.
<?php
$dbh = new PDO('odbc:sample', 'db2inst1', 'ibmdb2');
/* Delete all rows from the FRUIT table */
$count = $dbh->exec("DELETE FROM fruit WHERE colour = 'red'");
/* Return number of rows that were deleted */
print("Deleted $count rows.
");
?>
The above example will output:
Deleted 1 rows.
SEE ALSO PDO.prepare(3), PDO.query(3), PDOStatement.execute(3).
PHP Documentation Group PDO.EXEC(3)