> Does unix has a EOF char, like DOS does? How can I emulate an ^D by > program?
The eof character is set in the tty drivers under UNIX; if you want to send an EOF on a pipe you'ld have to close the pipe. > > The reason I'm asking is that I'm feeding both the plot command > and plot data to gnuplot (by command splot "-"). And I found out > that I need to press ^D to get out of data entry mode and get back > to command mode, to issue following commands.
I think it's easier to write the plotdata to a temporary file, and give the name of the file as argument to splot. > > I'm using the the following perl command to simulate the ^D, and > apparently gnuplot doesn't interpret plain ^D char. > > print GP "\n\004\n"; > > Is there any way to do that? Thanks!
There is a way to send EOF's from one process to another by using pseudoterminals (pty/tty pairs) I'll recommend you to read one of Stevens's books (Advanced Programming in the Unix Environment or Unix Network Programming) on the details. Anyway, the telnet deamon uses the trick!
Peter
When writing to a pipe, you send EOF to the reading process by closing the pipe.
However, if your intent was to continue writing more stuff to the pipe, you won't be able to. Perhaps you should be using a program that's designed to have data piped to it, rather than using one that expects to deal with an interactive terminal; I'll bet the gnuplot package includes such a thing.
If not, you'll probably have to use a pty, like the other responder mentioned. Perl probably has a package to automate this.
Barry Margolin
documented on: 2000.11.27 Mon 16:46:15