11-07-2011
Corona, that's my exact problem, I'm not allowed to make multiple reads this time, I already solved it that way by waiting for a child, reading the pipe, repeat
. I have to figure out a mechanism that allows me to read everything in the pipe at once, and store it, been googling for pipe I/O for a few hours now to no avail
.
10 More Discussions You Might Find Interesting
1. Programming
Hi,
I have a program that runs two threads in stead of two processes. I want to use pipe to redirect the output of the first thread to the input of the second thread.
One thread is continuously writing to a pipe, and the other thread will read from the pipe.
How do I do that?
Is there... (2 Replies)
Discussion started by: wminghao
2 Replies
2. Programming
I know how to read and write if i have a forked process with only one child. However what is involved with reading and writing with many forked processes. Say one parent that forks 5 children, and needs to communicate with all 5 in half duplex.
int temp, counter=0;
do{
pipe(temp);
... (5 Replies)
Discussion started by: steveneliuk
5 Replies
3. UNIX for Dummies Questions & Answers
Hi,
I will use below command for grep single string ("osuser" is search string)
ex: find . -type f | xarg grep -il osuser
but i have one more string "v$session"
here i want to grep in which file these two strings are present.
any help is appreciated,
Thanks in advance.
Gagan (2 Replies)
Discussion started by: gagan4599
2 Replies
4. Shell Programming and Scripting
Hi,
I have a requirement with,
No~Dt~Notes
1~2011/08/1~"aaa
bbb
ccc
ddd
eee
fff
ggg
hhh"
Single column alone got splitted into multiple lines.
I require the output as
No~Dt~Notes
1~2011/08/1~"aaa<>bbb<>ccc<>ddd<>eee<>fff<>ggg<>hhh"
mean to say those new lines to be... (1 Reply)
Discussion started by: Bhuvaneswari
1 Replies
5. Programming
how to read and write on pipes to communicate with each other? (5 Replies)
Discussion started by: nimesh
5 Replies
6. UNIX Desktop Questions & Answers
Hi,
I am trying to convert multiple Unix pipe symbol or bar into single |. I have tried with the following sed statements, but, no success :(. I need it using sed only
echo "sed 's/\|\+/\|/g'
sed 's/*/\|/'
sed 's/\|*/|/'
sed -r 's/\|+/\|/'
However, the below awk code is working fine.... (4 Replies)
Discussion started by: royalibrahim
4 Replies
7. Shell Programming and Scripting
Hi,
Input
7488 7389 chr1.fa chr1.fa
3546 9887 chr5.fa chr9.fa
7387 7898 chrX.fa chr3.fa
7488 7389 chr21.fa chr3.fa
7488 7389 chr1.fa chr1.fa
3546 9887 chr9.fa chr5.fa
7898 7387 chrX.fa chr3.fa
Desired Output
7488 7389 chr1.fa chr1.fa 2
3546 9887 chr5.fa chr9.fa 2... (2 Replies)
Discussion started by: jacobs.smith
2 Replies
8. UNIX for Dummies Questions & Answers
I have a script that finds all sffs and extracts them into .fastq file types. What I need to do is change the .fastq to .fasta using the below script. How can I change the input.fastq and output.fasta to mirror the file's name? Would I use an array and use the default iterator?
#!/bin/bash
... (3 Replies)
Discussion started by: jrymer
3 Replies
9. Shell Programming and Scripting
Single command to ls all the files inside a particular directory hierachy and output this to a file and open this in a vim file so that i can use gf command in vim to browse through all the files inside this hierachy.
eg :
dir1/dir2
and
dir1/dir3
dir2 and dir3 contain the files i need... (7 Replies)
Discussion started by: dll_fpga
7 Replies
10. UNIX for Beginners Questions & Answers
The task I have to do is something along the lines "I receive some input and based on the first character I send it through pipe to one of the children to print".
The scheme it is based on is 1->2; 1->3; 1->4; 2 will print all the input that starts with a letter, 3 will print all the input that... (2 Replies)
Discussion started by: Ildiko
2 Replies
LEARN ABOUT OPENSOLARIS
pipe
pipe(2) System Calls pipe(2)
NAME
pipe - create an interprocess channel
SYNOPSIS
#include <unistd.h>
int pipe(int fildes[2]);
DESCRIPTION
The pipe() function creates an I/O mechanism called a pipe and returns two file descriptors, fildes[0] and fildes[1]. The files associated
with fildes[0] and fildes[1] are streams and are both opened for reading and writing. The O_NDELAY, O_NONBLOCK, and FD_CLOEXEC flags are
cleared on both file descriptors. The fcntl(2) function can be used to set these flags.
A read from fildes[0] accesses the data written to fildes[1] on a first-in-first-out (FIFO) basis and a read from fildes[1] accesses the
data written to fildes[0] also on a FIFO basis.
Upon successful completion pipe() marks for update the st_atime, st_ctime, and st_mtime fields of the pipe.
RETURN VALUES
Upon successful completion, 0 is returned. Otherwise, -1 is returned and errno is set to indicate the error.
ERRORS
The pipe() function will fail if:
EMFILE More than {OPEN_MAX} file descriptors are already in use by this process.
ENFILE The number of simultaneously open files in the system would exceed a system-imposed limit.
ATTRIBUTES
See attributes(5) for descriptions of the following attributes:
+-----------------------------+-----------------------------+
| ATTRIBUTE TYPE | ATTRIBUTE VALUE |
+-----------------------------+-----------------------------+
|Interface Stability |Standard |
+-----------------------------+-----------------------------+
|MT-Level |Async-Signal-Safe |
+-----------------------------+-----------------------------+
SEE ALSO
sh(1), fcntl(2), fstat(2), getmsg(2), poll(2), putmsg(2), read(2), write(2), attributes(5), standards(5), streamio(7I)
NOTES
Since a pipe is bi-directional, there are two separate flows of data. Therefore, the size (st_size) returned by a call to fstat(2) with
argument fildes[0] or fildes[1] is the number of bytes available for reading from fildes[0] or fildes[1] respectively. Previously, the
size (st_size) returned by a call to fstat() with argument fildes[1] (the write-end) was the number of bytes available for reading from
fildes[0] (the read-end).
SunOS 5.11 23 Apr 2002 pipe(2)