Good evening everyone. I have my finals and I'm facing a problem:
I have a for cycle that is supposed to fork 2 children but somehow it forks only the first one.
What am I doing wrong ?
So, the program is pretty simple: I'm supposed to call the program ./program file_name
and its supposed to fork 2 children that will open the same file (argv[1] = file_name ). But as far as I can see I'm missing something because the program forks only one child.
In case you have not realized it, you are using terminazione incorrectly. It will never be zero since wait returns a pid on success (for which you should use pid_t, not int) and -1 on errors. This means that the else-clause is always executed.
Also, status is not the exit status of the process unless the process exited normally and returned 0. Otherwise, because status encodes information other than a simple exit status, the standardized macros must be used to inspect status.
I suggest that you carefully read your wait manual page.
Perhaps the time it took me to highlight these problems was wasted, because you may have already fixed them. I dont know because you did not post your solution. Please dont be selfish or inconsiderate. When you solve your problem, post your solution so that novices can benefit from what you have learned (and so experts can help further if there are still issues pending).
Hi All,
I have a requirement to read response file which looks like below
Ex:
NAME=SAM
DOB=01/01/1980
ADDRESS=
7658 James Street
NewYork
0000
Now, I need to take NAME, DOB, ADDRESS into variables
I am fine taking NAME and DOB
I need help on how can I... (6 Replies)
I am trying to find an example for reading an array instead of reading a file and send out an email in ksh. Can you please help is that possible?
Algorithm
#!/bin/ksh
i=0
set -A ARR
if
then
let i=$
ARR="A does n't match with B"
fi
if
then
let i=$
ARR="P does n't match with Q"... (11 Replies)
Good evening everyone. I have my finals and I'm facing a problem:
I have a for cycle that is supposed to fork 2 children but somehow it forks only the first one.
What am I doing wrong ?
#include <fcntl.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>... (1 Reply)
Hello,
In my directory i have got a list of files like below
unix1a.csv
unix1b.csv
unix1c.csv
unix1d.csv
unix1y.csv
I have done ls -lrt unix1.csv, how can i get my unix1y.csv also get listed along with this.. (5 Replies)
Hello everybody,
My first time here and my english is not very good I hope you understand me.
I'm trying to read a file that contains two zip archive names.
Here my file content is:
package1.zip package2.zip
At the end of the line there is a \n character.
I read this file from a... (2 Replies)
So, I want to read line-by-line a text file with unknown number of files....
So:
a=1
b=1
while ; do
b=`sed -n '$ap' test`
a=`expr $a + 1`
$here do something with b etc
done
the problem is that sed does not seem to recognise the $a, even when trying
sed -n ' $a p'
So, I cannot read... (3 Replies)
Hi,
I am having a hell of a time getting this to work. So basically, I have opened a popen to run a program that is going to prompt an action to occur half way through, when it gets to this I need to create a separate process and do some stuff, then return to the original process. This works... (0 Replies)
HI,
I have wrote a script which reads in a file that has a list of files within it.
The script then searches the directory for these files and when found will output to an email with a layout table indicating the date of the file and an ok status if the file = todays date if not a waiting... (1 Reply)
i'm just trying to make 2 process read from the same 1 line a time. For some reason only the child reads.
#include<stdio.h>
#include <sys/types.h>
void getlinefromfilep(void);
void getlinefromfilec(void);
int see=0;
FILE * fileptr1;
//need globe variable to tell pro3 to stop
main()... (3 Replies)