Sponsored Content
Full Discussion: unix & C doubts
Top Forums UNIX for Advanced & Expert Users unix & C doubts Post 5732 by Perderabo on Tuesday 21st of August 2001 03:09:18 PM
Old 08-21-2001
1) You put an ampersand & at the end of the line in your shell script to background the program. You can get all three running at once this way.


2) Use popen() to get a charater string with the answer. Then use sscanf() to convert that string to an integer.
 

9 More Discussions You Might Find Interesting

1. Solaris

Unix Administration doubts ********

Hi, Can anyone tell me the correct answers for these: 1. You have 4 instances running on the same UNIX box. How can you determine which shared memory and semaphores are associated with which instance? 2. How do you increase the OS limitation for open files (LINUX and/or Solaris)? Thanks:p (1 Reply)
Discussion started by: dreams5617
1 Replies

2. Programming

Doubts About C Compiler In Unix/linux

As all of you know whenever a program "say a.c" is complied in linux using the gcc or the cc compiler..it shows the list of errors ( if the program contains any).. i want to modify the compier script so as to list the no of errors only and not the description about the error..like" parse error " ... (1 Reply)
Discussion started by: vrs
1 Replies

3. UNIX for Dummies Questions & Answers

Unix doubts

Hello All, I am very new to UNIX. Please help me to find answers of below questions. 1.A script is saved with name ls. When we execute the script what it will execute? a) Will execute ls command b) Will execute the script c) Will execute script or command depends on the path ... (2 Replies)
Discussion started by: aswathy
2 Replies

4. Forum Support Area for Unregistered Users & Account Problems

How to post a new thread (Regarding Unix related doubts) in Unix Forums

How to post a new thread (Regarding Unix related doubts) in Unix Forums. I registered my id but I am unable to post my Questions to Forum. Thanks & Regards, indusri (1 Reply)
Discussion started by: indusri
1 Replies

5. UNIX for Dummies Questions & Answers

unix doubts

Write unix command to list or view auto links (0 Replies)
Discussion started by: ashishshah.engg
0 Replies

6. UNIX for Dummies Questions & Answers

Basic doubts related to Unix

Hi all, I have few question related to Unix environment and commands : 1. what is .chrc file contain and if it is not present then what happens. 2. what is .login file contain,in which dir it is present and what all other uses are their for this file 3. how and who calls .profile when you... (2 Replies)
Discussion started by: ravi.sadani19
2 Replies

7. UNIX for Dummies Questions & Answers

Unix doubts

Hi All, 1. how and who calls .profile when you login 2. what is PPID and what means by PPID = 0 Thanks in Advance (2 Replies)
Discussion started by: ravi.sadani19
2 Replies

8. Shell Programming and Scripting

Few Important doubts and questions..(Unix/Shell)

Hi All, I have a few questions which I am unable to solve/answer. Please help me with them:- Command in Unix to determine if a Host is connected to the internet ? If a parenet process is killed what happens to the child process? How do I print the first 10 lines of a file in the... (1 Reply)
Discussion started by: shubhranshu
1 Replies

9. Solaris

Unix scripting doubts

i hav a file like this -rwxr-xr-x 1 root controlm 4141 Nov 13 2006 /opt/scripts/prod/fvaauditlos.ksh -rwxr-xr-x 1 root controlm 3958 Nov 13 2006 /opt/scripts/prod/fvaexpchbk1.ksh -rwxr-xr-x 1 root controlm 6471 Nov 13 2006 /opt/scripts/prod/fvaexpchbk2.ksh... (24 Replies)
Discussion started by: p_satyambabu
24 Replies
popen(3)						     Library Functions Manual							  popen(3)

NAME
popen - Initiates a pipe to a process LIBRARY
Standard C Library (libc.so, libc.a) SYNOPSIS
#include <stdio.h> FILE *popen ( const char *command, const char *type ); STANDARDS
Interfaces documented on this reference page conform to industry standards as follows: popen(): XPG4, XPG4-UNIX Refer to the standards(5) reference page for more information about industry standards and associated tags. PARAMETERS
Points to a null-terminated string containing a shell command line. Points to a null-terminated string containing an I/O mode. DESCRIPTION
The popen() function creates a pipe between the calling program and a shell command to be executed. It returns a pointer to a FILE struc- ture for the stream. If the type parameter is the value r, the calling program can read from the standard output of the command by reading from the returned file stream. If the type parameter is the value w, the calling program can write to the standard input of the command by writing to the returned file stream. Because open files are shared, a type r command can be used as an input filter and a type w command as an output filter. NOTES
Programs using the popen() function to invoke an output filter should beware of possible deadlock caused by output data remaining in the program's buffer. This can be avoided by either using the setbuf() function to ensure that the output stream is unbuffered, or by using the fflush() function to ensure that all buffered data is flushed before calling the pclose() function. If the original processes and the process started with the popen() function concurrently read or write a common file, neither should use buffered I/O. If they do, the results are unpredictable. RETURN VALUES
Upon successful completion, the popen() function returns a pointer to the FILE structure for the opened stream. In case of error because files or processes could not be created, the popen() function returns a null pointer. RELATED INFORMATION
Functions: exec(2), fork(2), fclose(3), fopen(3), pclose(3), pipe(2), setbuf(3) Standards: standards(5) delim off popen(3)
All times are GMT -4. The time now is 05:04 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy