The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > High Level Programming
.
google unix.com



High Level Programming Post questions about C, C++, Java, SQL, and other programming languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Process creation Saurabh78 High Level Programming 1 09-12-2008 08:43 AM
how to Decrease priority of a particular process in time of process creation Ramkum UNIX for Dummies Questions & Answers 2 08-04-2008 10:04 AM
Getting process info in a program herbmiller High Level Programming 1 02-14-2008 12:53 PM
get program name give a process id naren_chella HP-UX 1 09-01-2006 08:33 AM
IO by Process/program cpiuk HP-UX 2 09-16-2004 05:24 AM

Reply
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 07-09-2009
dsudipta dsudipta is offline
Registered User
  
 

Join Date: Jul 2009
Posts: 3
Process creation in Unix with C Program

Hi,

can somebody please help me regarding this?
How can i print parent's PID from child's and vice versa.

I have tried with getpid() & ngetppid() function but it is not giving me the correct data. The logic i used is:

if (pid == 0)
{
getpid() : Chil'd PID
getppid(): Parent;s PID
}
else
{
getpid(): Parent's PID;
pid: Child' PID;
}

Output should match, right? But is is not matching.

If you have idea, please let me know.

With regards,
Sudipta
  #2 (permalink)  
Old 07-09-2009
jim mcnamara jim mcnamara is offline Forum Staff  
...@...
  
 

Join Date: Feb 2004
Location: NM
Posts: 5,805

Code:
pid=fork();

I do not see fork()....
Reply

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 03:19 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0