Sponsored Content
Top Forums Programming how exactly does pclose work in C? Post 302504896 by omega666 on Tuesday 15th of March 2011 05:26:23 PM
Old 03-15-2011
Question how exactly does pclose work in C?

If i have the pointer to the pipe, which is given to pclose, what exactly does pclose do with it?
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Script doesn't work, but commands inside work

Howdie everyone... I have a shell script RemoveFiles.sh Inside this file, it only has two commands as below: rm -f ../../reportToday/temp/* rm -f ../../report/* My problem is that when i execute this script, nothing happened. Files remained unremoved. I don't see any error message as it... (2 Replies)
Discussion started by: cheongww
2 Replies

2. UNIX for Advanced & Expert Users

pclose returning -1

Hi all, In my application i am trying to select some text & then give it to print. for this i am opening a stream using popen & then later closing using pclose. Now this is working fine in my environment (solaris) but the pclose function is failing at my clients m/c. Even though print is... (3 Replies)
Discussion started by: nimishm123
3 Replies

3. UNIX for Dummies Questions & Answers

cant get this to work

whoami | grep < $1 | echo $1 trying to write a script that finds out who the user is and then takes occurences of that username from a file that is passed as an argument and then displays it (6 Replies)
Discussion started by: iago
6 Replies

4. Linux

How does it work?

Can anyone explain how Graphic LCD (CSTN / STN) work in Unix... From Graphic file thro driver code to display....? Thanks (1 Reply)
Discussion started by: nat123
1 Replies

5. Linux

Come and work for me! (UK)

********nothing too see here!!!****** (2 Replies)
Discussion started by: TonyChapman
2 Replies

6. Shell Programming and Scripting

ls -d does not work

Hi falks, I need to dispaly a list of only directories . As it written in the manual ,the command to do it is 'ls -d'. When i issue 'ls -d' i'm getting: tornado.orca.ent:DB10g :/home/oracle/Create_Database > ls -d . Is anyone have any idea why id does not display directories ,or maybe... (11 Replies)
Discussion started by: nir_s
11 Replies

7. UNIX for Advanced & Expert Users

popen and pclose solved

Hi I am trying to use popen function with wrtie option to give inputs to ftp command. #include "stdio.h" int main(int argv ,char *argc) { int size=0; char *buf; FILE *fp; fp = popen("ftp","w"); while(getline(&buf,&size,stdin) != -1) write(fp,buf);... (0 Replies)
Discussion started by: kumaran_5555
0 Replies

8. IP Networking

NIC will not work, but it did work.

I have a client machine that was built and loaded with SCO UNIX 2.1.3, (yes it is old). The machine worked fine on the closed network that I tested on in my shop. I then had to change it to the network that it would be connected to. Below is the host file, router and subnet mask file that I usually... (0 Replies)
Discussion started by: NC user
0 Replies

9. Shell Programming and Scripting

My script work on Linux but not work in sunos.

My script work on Linux but not work in sun os. my script. logFiles="sentLog1.log sentLog2.log" intial_time="0 0" logLocation="/usr/local/tomcat/logs/" sleepTime=600 failMessage=":: $(tput bold)Log not update$(tput rmso) = " successMessage="OK" arr=($logFiles)... (7 Replies)
Discussion started by: ooilinlove
7 Replies

10. IP Networking

Discussion at work, would a router work pluging a cable in wan1 and lan1?

hi all. and sorry for the random question, but this sparkled a raging flame-war at work and i want more points of view situation a router, with linux of some sort, dhcp client requesting for ip in wan1 (as usual with wan ports) dhcp server listening in lan1, and assigning ip (as usual... (9 Replies)
Discussion started by: broli
9 Replies
explain_pclose(3)					     Library Functions Manual						 explain_pclose(3)

NAME
explain_pclose - explain pclose(3) errors SYNOPSIS
#include <libexplain/pclose.h> const char *explain_pclose(FILE *fp); const char *explain_errno_pclose(int errnum, FILE *fp); void explain_message_pclose(char *message, int message_size, FILE *fp); void explain_message_errno_pclose(char *message, int message_size, int errnum, FILE *fp); DESCRIPTION
These functions may be used to obtain explanations for errors returned by the pclose(3) system call. explain_pclose const char *explain_pclose(FILE *fp); The explain_pclose function is used to obtain an explanation of an error returned by the pclose(3) system call. The least the message will contain is the value of strerror(errno), but usually it will do much better, and indicate the underlying cause in more detail. The errno global variable will be used to obtain the error value to be decoded. This function is intended to be used in a fashion similar to the following example: if (pclose(fp) < 0) { fprintf(stderr, "%s ", explain_pclose(fp)); exit(EXIT_FAILURE); } The above code example is available pre-packaged as the explain_pclose_or_die(3) function. fp The original fp, exactly as passed to the pclose(3) system call. Returns: The message explaining the error. This message buffer is shared by all libexplain functions which do not supply a buffer in their argument list. This will be overwritten by the next call to any libexplain function which shares this buffer, including other threads. Note: This function is not thread safe, because it shares a return buffer across all threads, and many other functions in this library. explain_errno_pclose const char *explain_errno_pclose(int errnum, FILE *fp); The explain_errno_pclose function is used to obtain an explanation of an error returned by the pclose(3) system call. The least the mes- sage will contain is the value of strerror(errnum), but usually it will do much better, and indicate the underlying cause in more detail. This function is intended to be used in a fashion similar to the following example: if (pclose(fp) < 0) { int err = errno; fprintf(stderr, "%s ", explain_errno_pclose(err, fp)); exit(EXIT_FAILURE); } The above code example is available pre-packaged as the explain_pclose_or_die(3) function. errnum The error value to be decoded, usually obtained from the errno global variable just before this function is called. This is neces- sary if you need to call any code between the system call to be explained and this function, because many libc functions will alter the value of errno. fp The original fp, exactly as passed to the pclose(3) system call. Returns: The message explaining the error. This message buffer is shared by all libexplain functions which do not supply a buffer in their argument list. This will be overwritten by the next call to any libexplain function which shares this buffer, including other threads. Note: This function is not thread safe, because it shares a return buffer across all threads, and many other functions in this library. explain_message_pclose void explain_message_pclose(char *message, int message_size, FILE *fp); The explain_message_pclose function may be used to obtain an explanation of an error returned by the pclose(3) system call. The least the message will contain is the value of strerror(errno), but usually it will do much better, and indicate the underlying cause in more detail. The errno global variable will be used to obtain the error value to be decoded. This function is intended to be used in a fashion similar to the following example: if (pclose(fp) < 0) { char message[3000]; explain_message_pclose(message, sizeof(message), fp); fprintf(stderr, "%s ", message); exit(EXIT_FAILURE); } The above code example is available pre-packaged as the explain_pclose_or_die(3) function. message The location in which to store the returned message. If a suitable message return buffer is supplied, this function is thread safe. message_size The size in bytes of the location in which to store the returned message. fp The original fp, exactly as passed to the pclose(3) system call. explain_message_errno_pclose void explain_message_errno_pclose(char *message, int message_size, int errnum, FILE *fp); The explain_message_errno_pclose function may be used to obtain an explanation of an error returned by the pclose(3) system call. The least the message will contain is the value of strerror(errnum), but usually it will do much better, and indicate the underlying cause in more detail. This function is intended to be used in a fashion similar to the following example: if (pclose(fp) < 0) { int err = errno; char message[3000]; explain_message_errno_pclose(message, sizeof(message), err, fp); fprintf(stderr, "%s ", message); exit(EXIT_FAILURE); } The above code example is available pre-packaged as the explain_pclose_or_die(3) function. message The location in which to store the returned message. If a suitable message return buffer is supplied, this function is thread safe. message_size The size in bytes of the location in which to store the returned message. errnum The error value to be decoded, usually obtained from the errno global variable just before this function is called. This is neces- sary if you need to call any code between the system call to be explained and this function, because many libc functions will alter the value of errno. fp The original fp, exactly as passed to the pclose(3) system call. SEE ALSO
pclose(3) process I/O explain_pclose_or_die(3) process I/O and report errors COPYRIGHT
libexplain version 0.52 Copyright (C) 2009 Peter Miller explain_pclose(3)
All times are GMT -4. The time now is 10:19 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy