Here's my code:
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <wait.h>
#include <readline/readline.h>
#define NUMPIPES 2
int main(int argc, char *argv[]) {
char *bBuffer, *sPtr, *aPtr = NULL, *pipeComms[NUMPIPES], *cmdArgs[10];
int fdPipe[2], ...
|
I've created a question about this a few days. My solution is something in the lines of what was suggested in the accepted answer. However, a friend of mine came ... |
I am working on a relatively simple, independent "process starter" that I would like to get to work on Windows (XP, Vista, 7), Linux (Ubuntu 10.10) and especially Mac OS X ... |
I've been using a combination of fork() and exec() to execute some external command on linux, however, the code seems to fail whenever I try to execute /usr/bin/firefox which is a ... |
I'm trying to pass a pipe to another process, which I create with execv. This is my code so far, but it doesn't work. I've looked everywhere for information, ... |
I'm making a program for Linux in C that recieves a directory as an argument, then for each file in that directory and each of it's sub-directories, calls a program called ... |
For some reason that I am unaware of, my only my first execl statement is executing in the following code:
pid = fork();
if(pid < 0){
fprintf(stderr, "Fork Failed.\n");
...
|
|
I'm want to create a lot of child processes using the fork > exec procedure. Many processes are ending very fast (in less than two minutes, some even earlier).
My first problem ... |
I want to implement multi pipes in c so I can do something like this, where ||| means duplicate the stdin to N pipe commands):
cat /tmp/test.log ||| wc -l ||| grep ... |
I am trying to implement multiple pipes in C,
the solution should be both for:
cmd1 | cmd2 | cmd3
and for:
|--- cmd2
cmd1 ...
|
I have a program which executes multiple programs depending on i. See the following code block:
for(i=0;i<5;i++){
switch(i){
case 0:
if(fork())result=execl(transportProtoSnd,transportProtoSnd,RTPport, NULL);
if(result<0){printf("ERRNO: %d\n", errno);exit(0);}
...
|
Pretty much as the title says. I have a snippet of code that looks like this:
pid_t = p;
p = fork();
if (p == 0) {
childfn();
} else if (p ...
|
Problem solved. Actually the prob wasn't with my Parent code but it was the other program code which I was trying to spawn. Added a while(1){} to the code and it worked well. Previously the code had exited (thru return 0) thus, resulting the myApp to appear when spawned. Thanks Raghu and cheers.... |
|
|
Here's my code: Code: #include #include #include #include #include int main(int argc, char *argv[]) { char *bBuffer, *sPtr, *aPtr = NULL, *pipeComms[2], *cmdArgs[10]; int fdPipe[2], pCount, aCount, i, status; pid_t pid; pipe(fdPipe); while(1) { bBuffer = readline("Shell> "); if(!strcasecmp(bBuffer, "exit")) { return 0; } sPtr = bBuffer; pCount = -1; do { aPtr = strsep(&sPtr, "|"); ... |
17. fork + exec cboard.cprogramming.com |