Search Results

Search: Posts Made By: lamachejo
Forum: Programming 12-25-2011
13,332
Posted By Corona688
The program executed by execl is the child. ...
The program executed by execl is the child.

The parent can read those values, yes. The child writes to the pipe, the parent reads. It's the same pipe even after fork() so they are connected by...
Forum: Programming 12-25-2011
13,332
Posted By Corona688
Your program will likely crash or malfunction,...
Your program will likely crash or malfunction, since argv[0] is traditionally the name of the program, and the argument after the last one you give execl must be null, so try this:

const char...
Forum: Programming 12-24-2011
13,332
Posted By Corona688
if ((PID1=fork())==0) { // child ...
if ((PID1=fork())==0) { // child
close(fd[0]);
dup2(fd[1],STDOUT_FILENO)
close(fd[1]); // close ALL loose ends!
execl("~/Escritorio/SO/todos-P-Modulo2-Sesion4/esclavo","2","10"); ...
Forum: Programming 12-12-2011
9,222
Posted By Corona688
Yes, that's it. exec() replaces your current...
Yes, that's it. exec() replaces your current program. You have to fork, whether you want it in the foreground or not. Just wait() for processes to finish if they're in the "foreground".

There's...
Forum: Programming 12-09-2011
3,993
Posted By Corona688
You're not quitting in your child code, so they...
You're not quitting in your child code, so they finish executing the child code then continue blithely on into the parent code. Since you haven't posted your complete code I can't tell what they'd...
Forum: Programming 06-10-2011
5,858
Posted By Corona688
Makes sense, yeah. It looks like hexdump...
Makes sense, yeah. It looks like hexdump squeezed some zeroes together though, where it put the *, got to watch for that.

You can write entire structures and such to file by the way, you don't...
Forum: Programming 06-10-2011
5,858
Posted By Corona688
Look closer. #include <stdio.h> int...
Look closer.

#include <stdio.h>
int main(void)
{
int n=32;
fwrite(&n, 1, sizeof(n), stdout);
}

$ ./a.out > bin.bin
$ hexdump -C bin.bin
00000000 20 00 00 00 ...
Forum: Programming 06-10-2011
5,858
Posted By Corona688
Depends what's in it. Your integers are probably...
Depends what's in it. Your integers are probably four bytes. "32\n" would be slightly smaller. Whereas binary is always the same size every time. hexdump -C filename
Forum: Programming 05-25-2011
1,384
Posted By DGPickett
Well, to match, you need to lose the * in the...
Well, to match, you need to lose the * in the definition, too.

Dynamic Memory - C++ Documentation (http://www.cplusplus.com/doc/tutorial/dynamic/)

However, now I see from your diagram, you...
Forum: Programming 04-03-2011
1,498
Posted By achenle
The "(i%7==0)" is incorrect. It only works the...
The "(i%7==0)" is incorrect. It only works the first time i hits 7.

It should be( ( ( i + 1 ) % 8 ) == 0 )And not the parenthesis. I'm not sure about operator precedence between "+", "==", and...
1,722
Posted By ctsgnb
space matter ! if [ "$opcion" = "p" ] <---good ...
space matter !
if [ "$opcion" = "p" ] <---good
if [ "$opcion"="p" ] <---badyou might want to use a case statement instead of if

case $1 in
p)
echo $1
echo "Escribe una cadena"
read cadena...
1,838
Posted By Chubler_XL
Perhaps something like this, and don't forget to...
Perhaps something like this, and don't forget to run with $ . script_name

#!/bin/bash
trabajo=$1
numero=$(jobs | awk -F [][] "/$trabajo/"' {print $2; exit}')
if [ -z "$numero" ]
then
echo...
1,838
Posted By Chubler_XL
Jobs will only list jobs started by the current...
Jobs will only list jobs started by the current shell. As your scipt is run in it's own version of the shell it won't should jobs started by the parent shell. You man need to use ps to do this (or...
1,838
Posted By bisbell
That is because jobs are local to the shell. ...
That is because jobs are local to the shell. When you run a script you are creating a child shell and in this child the list of jobs are not inherited from the parent.

Try sourcing your script-...
2,362
Posted By rwuerth
In this case, since the actual process name is...
In this case, since the actual process name is hidden in a variable, I'd go with adding a second pipe to your statement like so:


pe -ef | grep -q $process | grep -v grep


The -v option...
4,059
Posted By Corona688
We may have crossposted. Try "$@", quotes and...
We may have crossposted. Try "$@", quotes and all, that should expand to "$1" "$2" "$3" ...
Showing results 1 to 16 of 16

 
All times are GMT -4. The time now is 03:57 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy