There are examples on this forum and online.
I found one done example by doing sqlplus cooprocess ksh search in google.
Regards
Peasant.
I didn't know about coprocesses before. In my case, I think, writing a parser with coprocesses is not needed and too complicated (for such a small requirement).
Is it possible to do a redirection to a process by it's PID? For example:
Quote:
Originally Posted by Don Cragun
Send email to yourself, send a message to a message queue, write to a regular file, write to a FIFO file, send a signal, write some text into a shared memory segment... There are hundreds of ways to do this.
May you provide an example, please? It would be good to send a signal from cmd2 to cmd1, but how may I tell cmd1 to interpret the signal I a proper way (changing sqlprompt)?
---------- Post updated at 01:57 PM ---------- Previous update was at 01:46 PM ----------
I found something. When I have sqlplus running and in another session I do:
then in sqlplus I receive:
Quote:
myuser@mydb SQL> TEst;
But the message is not interpreted at all (is only printed) by sqlplus, unfortunately.
---------- Post updated at 04:26 PM ---------- Previous update was at 01:57 PM ----------
You can't do that. /proc/fd/0 is (usually) not a pipe which you can write to and give the process input.
What you need to do, is invoke the process with its stdin coming from something that IS a pipe (or socket etc) so that you can write stuff into it.
A named pipe MAY work here (see mknod(1) or mkfifo(3) ).
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,
i want to write a script that executes a program (exec?) .
this program then requires a filename as input.
how do i give it this input in the script so the program will be complete run and close by the script.
e.g.
exec prog.exe
program then asks for filename
"enter filename:"... (1 Reply)
Hi,
I would like to write a program to receive the GPS data and then send the data via network to other program.
All of the program is not write yet(include host and sender)
All of the server OS is unix or linux
Could you mind to give me some idea to do this?
Thanks so much!
Ken
... (2 Replies)
Hello,
I recently upgraded our server from Solaris 8 to 9. The sendmail is unabled to pipe the email to a perl script. I can send and received email to local and external mail, but the script did not get the email. There is no error in the log and I could not find any thing on the web.
Here... (0 Replies)
Hello guys,
my professor give me 2 days to study and make a program usign pipe, fork in c
i need to do a program
read a arq.txt
the father process read the file and the child print !
like this
#include <stdio.h>
#include <stdlib.h>
#include <sys/wait.h>
int main (){
... (1 Reply)
Hello guys,
my professor give me 2 days to study and make a program usign pipe, fork in c
i need to do a program
read a arq.txt
the father process read the file and the child print !
2. Relevant commands, code, scripts, algorithms:
like this
Code:
#include <stdio.h>... (1 Reply)
Hi,
I am trying to sftp a large file(appx. 2 GB size) from solaris 10 to a Linux server. While sftping(with no options), connection is terminated after some time with broken pipe error. sftp with option -R1 or -B1500 is successful.
Linux server ssh Version: OpenSSH_3.9p1, OpenSSL 0.9.7a... (3 Replies)
Hi all,
I have a text data file. My aim here is to find line called *FIELD* AV for every record and print lines after that till *FIELD* RF. But here I want first 3 to four lines for very record as well. FIELD AV is some where in between for very record. SO I am not sure how to retrieve lines in... (2 Replies)
For example, I have a file called number.txt.
x y
1 1
2 4
3 9
4 6
5 5
6 6
7 9
8 4
9 1
10 0
...
And I want to print out the value of x and y, if y%4==0 and the next value of y%4==0. Thus, the sample output is:
1 1 *because the previous x before 2 is 1
2 4 *because 4%4 == 0
7 9... (2 Replies)
Hi Guys,
I am getting some strange error in /var/adm/messages in my Solaris 10 box with Veritas Cluster and EMC storage.
bash-3.00$ cat /var/adm/messages | egrep -v "lw8|snmp|sshd|xntpd|kern.info|LOGIN|link|service|started|finished|repeated|SS7 Log-daemon|success"
Dec 18 09:58:35 GAMMa2... (1 Reply)
Discussion started by: vivek.goel.piet
1 Replies
LEARN ABOUT SUNOS
fflush
fflush(3C) Standard C Library Functions fflush(3C)NAME
fflush - flush a stream
SYNOPSIS
#include <stdio.h>
int fflush(FILE *stream);
DESCRIPTION
If stream points to an output stream or an update stream in which the most recent operation was not input, fflush() causes any unwritten
data for that stream to be written to the file, and the st_ctime and st_mtime fields of the underlying file are marked for update.
If stream points to an input stream or an update stream into which the most recent operation was input, that stream is flushed if it is
seekable and is not already at end-of-file. Flushing an input stream discards any buffered input and adjusts the file pointer such that
the next input operation accesses the byte after the last one read. A stream is seekable if the underlying file is not a pipe, FIFO,
socket, or TTY device.
If stream is a null pointer, fflush() performs this flushing action on all streams for which the behavior is defined above.
An input stream, seekable or non-seekable, can be flushed by explicitly calling fflush() with a non-null argument specifying that stream.
RETURN VALUES
Upon successful completion, fflush() returns 0. Otherwise, it returns EOF and sets errno to indicate the error.
ERRORS
The fflush() function will fail if:
EAGAIN The O_NONBLOCK flag is set for the file descriptor underlying stream and the process would be delayed in the write opera-
tion.
EBADF The file descriptor underlying stream is not valid.
EFBIG An attempt was made to write a file that exceeds the maximum file size or the process's file size limit; or the file is a
regular file and an attempt was made to write at or beyond the offset maximum associated with the corresponding stream.
EINTR The fflush() function was interrupted by a signal.
EIO The process is a member of a background process group attempting to write to its controlling terminal, TOSTOP is set, the
process is neither ignoring nor blocking SIGTTOU, and the process group of the process is orphaned.
ENOSPC There was no free space remaining on the device containing the file.
EPIPE An attempt is made to write to a pipe or FIFO that is not open for reading by any process. A SIGPIPE signal will also be
sent to the calling process.
The fflush() function may fail if:
ENXIO A request was made of a non-existent device, or the request was beyond the limits of the device.
ATTRIBUTES
See attributes(5) for descriptions of the following attributes:
+-----------------------------+-----------------------------+
| ATTRIBUTE TYPE | ATTRIBUTE VALUE |
+-----------------------------+-----------------------------+
|Interface Stability |Standard |
+-----------------------------+-----------------------------+
|MT-Level |MT-Safe |
+-----------------------------+-----------------------------+
SEE ALSO getrlimit(2), ulimit(2), attributes(5), standards(5)SunOS 5.10 1 Nov 2003 fflush(3C)