Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C Programming > using select to read STDIN?

Reply
Thread Tools

using select to read STDIN?

 
 
ifmusic@gmail.com
Guest
Posts: n/a
 
      05-16-2006
Hi!, i have a "server-like" application:
i use select to accept and recieve data from Sockets.
I want to Add a menu to this app something like "pick an option" thing,
but it has to show data according to data recieved from Sockets..

I found a way to do it with Fork, i mean, First i fork;in the Child i
do all the menu stuff and in the "else" part (the parent part) i have
the rest (the while(1) with a select inside). But i dont like this
because, i don't like forking just for a menu! and i have to create a
socket to communicate with the parent.

i was thinking.. isn't it possible to tell the select to read and show
the stdin, after all, it's a FD.
I tried this but i couldn't get it to work correctly, i ran into
trouble like "recv cant read from a Non-socket fd" "i read the stdin
with "read" but i reads char by char -i guess- and it remains "ready"
so select, keeps selecting stdin forever.

so, i don't know which is THE way to do it correcly if there is such a
thing.

Thanks.

 
Reply With Quote
 
 
 
 
Robert Gamble
Guest
Posts: n/a
 
      05-16-2006
http://www.velocityreviews.com/forums/(E-Mail Removed) wrote:
> Hi!, i have a "server-like" application:
> i use select to accept and recieve data from Sockets.
> I want to Add a menu to this app something like "pick an option" thing,
> but it has to show data according to data recieved from Sockets..
>
> I found a way to do it with Fork, i mean, First i fork;in the Child i
> do all the menu stuff and in the "else" part (the parent part) i have
> the rest (the while(1) with a select inside). But i dont like this
> because, i don't like forking just for a menu! and i have to create a
> socket to communicate with the parent.
>
> i was thinking.. isn't it possible to tell the select to read and show
> the stdin, after all, it's a FD.
> I tried this but i couldn't get it to work correctly, i ran into
> trouble like "recv cant read from a Non-socket fd" "i read the stdin
> with "read" but i reads char by char -i guess- and it remains "ready"
> so select, keeps selecting stdin forever.
>
> so, i don't know which is THE way to do it correcly if there is such a
> thing.


This is the wrong group, we limit our discussions to Standard C here
which does not include sockets, forking, etc.; try
comp.unix.programmer.

Robert Gamble

 
Reply With Quote
 
 
 
 
ifmusic@gmail.com
Guest
Posts: n/a
 
      05-16-2006

ok, i will

sorry.

 
Reply With Quote
 
CBFalconer
Guest
Posts: n/a
 
      05-16-2006
(E-Mail Removed) wrote:
>
> Hi!, i have a "server-like" application:
> i use select to accept and recieve data from Sockets.
> I want to Add a menu to this app something like "pick an option" thing,
> but it has to show data according to data recieved from Sockets..
>
> I found a way to do it with Fork, i mean, First i fork;in the Child i
> do all the menu stuff and in the "else" part (the parent part) i have
> the rest (the while(1) with a select inside). But i dont like this
> because, i don't like forking just for a menu! and i have to create a
> socket to communicate with the parent.


You probably want a newsgroup with 'restaurant' or 'dining' or
something like that in its name. This is comp.lang.c, which has
nothing whatsoever to do with menus, selecting therefrom, forks,
serving, sockets, parents. There is also a remote chance that
comp.unix.programmer would be useful.

--
"If you want to post a followup via groups.google.com, don't use
the broken "Reply" link at the bottom of the article. Click on
"show options" at the top of the article, then click on the
"Reply" at the bottom of the article headers." - Keith Thompson
More details at: <http://cfaj.freeshell.org/google/>
Also see <http://www.safalra.com/special/googlegroupsreply/>


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
select gridview row without using select button? =?Utf-8?B?RGFiYmxlcg==?= ASP .Net 5 02-27-2009 02:56 AM
select box - using refresh to select same item twice entfred@hotmail.com Javascript 2 07-25-2006 11:54 PM
Dumb question about using a <SELECT> menu to change the state of<SELECT> menu... Bonge Boo! Javascript 5 04-25-2005 10:49 PM
Using select() and read(); Martin Holm Pedersen C Programming 10 05-14-2004 02:55 AM
select of select box will select multiple in another box palmiere Javascript 1 02-09-2004 01:11 PM



Advertisments