Terminal input and pipe - possible to have both?

K

kotzkroete

Hi,
I just started working on a simple 'more' version.
I use it like this:
cat blabla.txt | more

Here is my problem:
Since more gets its input through a pipe I can't use stdin for
keyboard input anymore and thus can't scroll with space and return.

How can I have one filestream for the pipe and another for regular
keyboard input?
Is this possible?
 
K

Kenny McCormack

Hi,
I just started working on a simple 'more' version.
I use it like this:
cat blabla.txt | more

Here is my problem:
Since more gets its input through a pipe I can't use stdin for
keyboard input anymore and thus can't scroll with space and return.

How can I have one filestream for the pipe and another for regular
keyboard input?
Is this possible?

Not in standard C...

IOW:

Off topic. Not portable. Cant discuss it here. Blah, blah, blah.

--
Useful clc-related links:

http://en.wikipedia.org/wiki/Aspergers
http://en.wikipedia.org/wiki/Clique
http://en.wikipedia.org/wiki/C_programming_language
 
K

kotzkroete

Ok,
but is there a function that doesn't echo everything I type?
Because when I hit enter I get 2 newlines (the one at the end of the
line and my input).
 
S

santosh

Hi,
I just started working on a simple 'more' version.
I use it like this:
cat blabla.txt | more

Here is my problem:
Since more gets its input through a pipe I can't use stdin for
keyboard input anymore and thus can't scroll with space and return.

How can I have one filestream for the pipe and another for regular
keyboard input?
Is this possible?

This is topical to <news:comp.unix.programmer>
 
K

Kenny McCormack

Ok,
but is there a function that doesn't echo everything I type?
Because when I hit enter I get 2 newlines (the one at the end of the
line and my input).

Again, not in standard C, blah, blah, blah...
 
S

santosh

Ok,
but is there a function that doesn't echo everything I type?
Because when I hit enter I get 2 newlines (the one at the end of the
line and my input).

You need to use system specific mechanisms to do this. Find a group
specific for your system. Since you seem to be using a UNIX type system
<as I suggested earlier, will be a better
group to ask these questions.
 
M

mazwolfe

Hi,
I just started working on a simple 'more' version.
I use it like this:
cat blabla.txt | more

Here is my problem:
Since more gets its input through a pipe I can't use stdin for
keyboard input anymore and thus can't scroll with space and return.

How can I have one filestream for the pipe and another for regular
keyboard input?
Is this possible?

As mentioned, this is not standard C. You might try opening /dev/tty
and reading from that (this idea comes from The Unix Programming
Environment, I think by Thompson and Pike - I may be wrong about
that). On a DOS/Win environment, open the device "CON", it should
accomplish the same thing.

-- Marty (a newbie, so feel free to ignore me)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Staff online

Members online

Forum statistics

Threads
473,769
Messages
2,569,577
Members
45,052
Latest member
LucyCarper

Latest Threads

Top