Hi,
i am using the below program to read from the standard input or to write to standard out put.
i know that using highlevel functions this can be done better than what i have done here.
i just want to know is there any other method by which i find the exact number of characters ( this will vary in each iteration ) , and write that to STDOUT.
this process i want to terminate with a press of "q".
does read syscall stores the null at the end of string, i have not found that in debug mode.
below is the sample code but its has got the problem of reading and writing garbages.
Hi,
Program A: uses pipe()
I am able to read the stdout of PROGAM B (stdout got through system() command) into PROGRAM A using:
* child
-> dup2(fd, STDOUT_FILENO);
-> execl("/path/PROGRAM B", "PROGRAM B", NULL);
* parent
-> char line;
-> read(fd, line, 100);
Question:... (2 Replies)
Hi everyone, first post here.
Anyone who isn't interested in the background, press pagedown :).
I sometimes need to make scripts for little things I need in the infrastructure at the company I work at. Currently I am trying to make a wrapper script for a proprietary image-deployment program.... (2 Replies)
Hi all
I've run into a snag in a program of mine where part of what I entered in at the start of run-time, instead of the current value within printf() is being printed out.
After failing with fflush() and setbuf(), I tried the following approach
void BufferFlusher()
{
int in=0;... (9 Replies)
Hi,
i know how to
a) redirect stdout and stderr to one file,
b) and write to two files concurrently with same output using tee command
Now, i want to do both the above together.
I have a script and it should write both stdout and stderr in one file and also write the same content to... (8 Replies)
Hi,
I am working on a project where I have to generate and execute nasm code on-the-fly. I generate the code in a file program.asm and then execute it.This output is to stdout which i redirect to an output file which i read back to compare results:
system("nasm -f elf program.asm >... (5 Replies)
All,
Ok...so I know I *should* be able to control a process's stdin and stdout from the parent by creating pipes and then dup'ing them in the child. And, this works with all "normal" programs that I've tried. Unfortunately, I want to intercept the stdin/out of the scp application and it seems... (9 Replies)
I want to differentiate the STDOUT and STDERR messages in my terminal .
If a script or command is printing a message in terminal I want to differentiate by colors,
Is it possible ?
Example:
$date
Wed Jul 27 12:36:50 IST 2011
$datee
bash: datee: command not found
$alias ls
alias... (2 Replies)
Well.. let's say i need to write a pretty simple script.
In my script i have 2 variables which can have value of 0 or 1.
$VERBOSE
$LOG
I need to implement these cases:
($VERBOSE = 0 && $LOG = 0) => ONLY ERROR output (STDERR to console && STDOUT to /dev/null)
($VERBOSE = 1... (5 Replies)
Discussion started by: Marmz
5 Replies
LEARN ABOUT DEBIAN
gnupg::handles
GnuPG::Handles(3pm) User Contributed Perl Documentation GnuPG::Handles(3pm)NAME
GnuPG::Handles - GnuPG handles bundle
SYNOPSIS
use IO::Handle;
my ( $stdin, $stdout, $stderr,
$status_fh, $logger_fh, $passphrase_fh,
)
= ( IO::Handle->new(), IO::Handle->new(), IO::Handle->new(),
IO::Handle->new(), IO::Handle->new(), IO::Handle->new(),
);
my $handles = GnuPG::Handles->new
( stdin => $stdin,
stdout => $stdout,
stderr => $stderr,
status => $status_fh,
logger => $logger_fh,
passphrase => $passphrase_fh,
);
DESCRIPTION
GnuPG::Handles objects are generally instantiated to be used in conjunction with methods of objects of the class GnuPG::Interface.
GnuPG::Handles objects represent a collection of handles that are used to communicate with GnuPG.
OBJECT METHODS
Initialization Methods
new( %initialization_args )
This methods creates a new object. The optional arguments are initialization of data members.
hash_init( %args ).
OBJECT DATA MEMBERS
stdin
This handle is connected to the standard input of a GnuPG process.
stdout
This handle is connected to the standard output of a GnuPG process.
stderr
This handle is connected to the standard error of a GnuPG process.
status
This handle is connected to the status output handle of a GnuPG process.
logger
This handle is connected to the logger output handle of a GnuPG process.
passphrase
This handle is connected to the passphrase input handle of a GnuPG process.
command
This handle is connected to the command input handle of a GnuPG process.
options
This is a hash of hashrefs of settings pertaining to the handles in this object. The outer-level hash is keyed by the names of the
handle the setting is for, while the inner is keyed by the setting being referenced. For example, to set the setting "direct" to true
for the filehandle "stdin", the following code will do:
# assuming $handles is an already-created
# GnuPG::Handles object, this sets all
# options for the filehandle stdin in one blow,
# clearing out all others
$handles->options( 'stdin', { direct => 1 } );
# this is useful to just make one change
# to the set of options for a handle
$handles->options( 'stdin' )->{direct} = 1;
# and to get the setting...
$setting = $handles->options( 'stdin' )->{direct};
# and to clear the settings for stdin
$handles->options( 'stdin', {} );
The currently-used settings are as follows:
direct
If the setting "direct" is true for a handle, the GnuPG process spawned will access the handle directly. This is useful for having
the GnuPG process read or write directly to or from an already-opened file.
SEE ALSO
GnuPG::Interface,
perl v5.12.4 2009-04-21 GnuPG::Handles(3pm)