Sponsored Content
Full Discussion: C - WEXITSTATUS() question
Top Forums Programming C - WEXITSTATUS() question Post 302361949 by jim mcnamara on Wednesday 14th of October 2009 01:48:22 PM
Old 10-14-2009
Code:
pid_t waitpid(pid_t pid, int *status, int options);
// use WNOHANG as the option

This returns the pid when if the process ended, or it checks and returns right away if the child process is still active.

---------- Post updated at 11:48 ---------- Previous update was at 11:00 ----------

If it is not a child process -

try
Code:
errno=0;
if(kill(pid, 0) == 0 )
{
    printf("process running\n");
}
else

{
    if(errno==ESRCH)
        printf("process stopped\n");
    else
    {
        perror("cannot signal the process");
        exit(1);
     }
}

 

8 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Well, im getting it, but i have ONE question

Hay everyone, i would like to take this opportunity to thank all of you who helped me make the decision to get a linux distro. As a newbie, Im defininately considering buying Mandrake Linux... I went to the site and phew..... 2300 applications, i think ill have a good time. But i do have a... (5 Replies)
Discussion started by: LolapaloL
5 Replies

2. UNIX for Dummies Questions & Answers

Next Question:

what is the function of swap in linux why i have to create apsolutely a particion for the swap when i install (i installed lnx4win mandrake and made an automat. disk particion and the install program one of my disk partitions that was 3gb devidet in 4 one native 700mb swap 600mb and the others i... (1 Reply)
Discussion started by: user666
1 Replies

3. UNIX for Dummies Questions & Answers

another question?

what happens if the script doesn't get Y,y,N, or n? Will it just loop back up and ask the question again? I tried to get mine to give me another response to tell me my input was invalid, but ran into problems with it. (8 Replies)
Discussion started by: wmosley2
8 Replies

4. UNIX for Dummies Questions & Answers

question?

Is there any way to use sed and count the number of alphabetic characters in a sentence? (4 Replies)
Discussion started by: brentdeback
4 Replies

5. Programming

Question on order of headers and WEXITSTATUS

In one of the Unix Programming FAQ's they have the following headers in the program to catch SIGCHLD #include <sys/types.h> /* include this before any other sys headers */ #include <sys/wait.h> /* header for waitpid() and various macros */ #include <signal.h> /* header for signal... (5 Replies)
Discussion started by: frequency8
5 Replies

6. Programming

C++ little question

Hi, I am doing a C++ self-study and I got stuck with this problem. I want to have a code that asks the suer to enter two numbers and then it lists the numbers between these two numbers. It has also to print a message if these two numbers are equal. Here is what I wrote: #include <iostream>... (11 Replies)
Discussion started by: faizlo
11 Replies

7. Programming

help with WEXITSTATUS in C

when a execute this line printf("%d\n",WEXITSTATUS(status)); i get no output, whats could be the possible causes? ---------- Post updated at 09:29 PM ---------- Previous update was at 09:27 PM ---------- nvm i figured it out, u can delete this thread (0 Replies)
Discussion started by: omega666
0 Replies

8. Shell Programming and Scripting

wc question

I am new to unix. how to get only the no. of lines output from the wc -l command. Input: wc -l filename it gives <no.of lines> filename i need only the interger value. as <no.of lines> Thanks in advance (2 Replies)
Discussion started by: sanvel
2 Replies
ppmtosixel(1)						      General Commands Manual						     ppmtosixel(1)

NAME
ppmtosixel - convert a portable pixmap into DEC sixel format SYNOPSIS
ppmtosixel [-raw] [-margin] [ppmfile] DESCRIPTION
Reads a portable pixmap as input. Produces sixel commands (SIX) as output. The output is formatted for color printing, e.g. for a DEC LJ250 color inkjet printer. If RGB values from the PPM file do not have maxval=100, the RGB values are rescaled. A printer control header and a color assignment table begin the SIX file. Image data is written in a compressed format by default. A printer control footer ends the image file. OPTIONS
-raw If specified, each pixel will be explicitly described in the image file. If -raw is not specified, output will default to com- pressed format in which identical adjacent pixels are replaced by "repeat pixel" commands. A raw file is often an order of magni- tude larger than a compressed file and prints much slower. -margin If -margin is not specified, the image will be start at the left margin (of the window, paper, or whatever). If -margin is speci- fied, a 1.5 inch left margin will offset the image. PRINTING
Generally, sixel files must reach the printer unfiltered. Use the lpr -x option or cat filename > /dev/tty0?. BUGS
Upon rescaling, truncation of the least significant bits of RGB values may result in poor color conversion. If the original PPM maxval was greater than 100, rescaling also reduces the image depth. While the actual RGB values from the ppm file are more or less retained, the color palette of the LJ250 may not match the colors on your screen. This seems to be a printer limitation. SEE ALSO
ppm(5) AUTHOR
Copyright (C) 1991 by Rick Vinci. 26 April 1991 ppmtosixel(1)
All times are GMT -4. The time now is 06:33 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy