Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C Programming > stdin help

Reply
Thread Tools

stdin help

 
 
sajjanharudit@gmail.com
Guest
Posts: n/a
 
      01-04-2006
Can any one direct me to a group or discussion forum where the topic
could be "relevant". I am using linux as my platform.

 
Reply With Quote
 
 
 
 
tmp123
Guest
Posts: n/a
 
      01-04-2006
http://www.velocityreviews.com/forums/(E-Mail Removed) wrote:
> now the problem is that if i use getc() the program execution stpos at
> this line and waits for the user to press a key. cant use getchar
> because the key pressed appears on the screen and moreover it is
> buffered.
>

Hi,

As an starting point, can I suggest you to try the small program
below?.

Kind regards.

#include <stdio.h>
#include <sys/time.h>

struct timeval timeval_poll = {0,0};

int main ( void )
{
fd_set i;
int count=0;

FD_ZERO(&i);
FD_SET(1,&i);
while ( select(2,&i,NULL,NULL,&timeval_poll) == 0 )
{
printf("%d\n",count++);
FD_SET(1,&i);
}
printf("typed!\n");

return 0;
}

 
Reply With Quote
 
 
 
 
Keith Thompson
Guest
Posts: n/a
 
      01-04-2006
"Alastair" <(E-Mail Removed)> writes:
> Christopher Benson-Manica wrote:
>> Alastair <(E-Mail Removed)> wrote:
>>
>> > And further - I'll answer anything that I can help with.

>>
>> If you insist on answering off-topic questions, you could at least
>> cross-post to a group (or groups) where the answer is topical. If you
>> teach a man to ask questions in venues where the questions are
>> topical, he will never want for helpful suggestions.

>
> Fair enough....
>
>>Your post
>> provided little in the way of such helpful instruction.

>
> Maybe, In your opinon, but I wasn't trying to help someone else with my
> experience of the same problem (i.e. not you).
> anyway a request for - please stop attacking me and apply your efforts
> on helping answer the query...


Alastair, there are a number of good reasons why we try to avoid
off-topic discussions here. The matter has been discussed at great
length many many times, and I don't have time to go into the details
right now. Answering anything you can help with really isn't as
helpful as pointing the questioner to an appropriate newsgroup or
other resource. You can even jump over to another newsgroup to
continue the discussion in an environment full of experts on what the
questioner is asking about.

Consider the possibility that those of us who have been regulars in
this newsgroup for many years might actually know what we're doing.

--
Keith Thompson (The_Other_Keith) (E-Mail Removed) <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <*> <http://users.sdsc.edu/~kst>
We must do something. This is something. Therefore, we must do this.
 
Reply With Quote
 
Flash Gordon
Guest
Posts: n/a
 
      01-04-2006
tmp123 wrote:
> (E-Mail Removed) wrote:
>> now the problem is that if i use getc() the program execution stpos at
>> this line and waits for the user to press a key. cant use getchar
>> because the key pressed appears on the screen and moreover it is
>> buffered.
>>

> Hi,
>
> As an starting point, can I suggest you to try the small program
> below?.
>
> Kind regards.
>
> #include <stdio.h>
> #include <sys/time.h>


This is not a standard header.

> struct timeval timeval_poll = {0,0};


timeval is not part of stadnard C.

> int main ( void )
> {
> fd_set i;


<snip>

fd_set is not part of standard C. In fact, most of what you have written
is not standard C and not available on all platforms and so may not be
available on the OPs platform and even if it is may not be the
appropriate solution.

You have been reading this group long enough to have seen advice on
topicality, but once more, DON'T post off topic advice without at the
very least redirecting the discussion to a more appropriate group where
people that know about the matter will be able to review and comment on
your advice.
--
Flash Gordon
Living in interesting times.
Although my email address says spam, it is real and I read it.
 
Reply With Quote
 
Flash Gordon
Guest
Posts: n/a
 
      01-04-2006
(E-Mail Removed) wrote:

Please provide context when posting, Google is not Usenet and people
might not have seen the post you are replying to., see
http://cfaj.freeshell.org/google/ instructions on how to post properly
through Google.

> Can any one direct me to a group or discussion forum where the topic
> could be "relevant". I am using linux as my platform.


comp.programmer.unix or comp.linux.development.apps might be a good
starting point, after checking their FAQ to see if your question is
answered there.
--
Flash Gordon
Living in interesting times.
Although my email address says spam, it is real and I read it.
 
Reply With Quote
 
Chuck F.
Guest
Posts: n/a
 
      01-04-2006
(E-Mail Removed) wrote:
>
> Can any one direct me to a group or discussion forum where the
> topic could be "relevant". I am using linux as my platform.


Since you failed to provide any context, nobody has the slightest
idea what you want. For means of so doing, see my sig and the
reference therein below. Read those before making any further
response on this newsgroup.

--
"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/>
 
Reply With Quote
 
Chuck F.
Guest
Posts: n/a
 
      01-04-2006
tmp123 wrote:
> (E-Mail Removed) wrote:
>
>> now the problem is that if i use getc() the program execution
>> stpos at this line and waits for the user to press a key. cant
>> use getchar because the key pressed appears on the screen and
>> moreover it is buffered.

>
> As an starting point, can I suggest you to try the small program
> below?.
>
> Kind regards.
>
> #include <stdio.h>
> #include <sys/time.h>

.... snip rest ...

sys/time.h is not a part of standard C, which makes your entire
post off-topic.

--
"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/>
 
Reply With Quote
 
Kenny McCormack
Guest
Posts: n/a
 
      01-04-2006
In article <(E-Mail Removed)>,
Chuck F. <(E-Mail Removed)> wrote:
....
>Please don't answer off-topic queries with off-topic material.
>Limit your reply to suggestions as to where to look. The reason is
>that the experts who can correct any errors you might make are not
>here to make those corrections, so bad advice may not be caught.


And that would be a tragedy...

 
Reply With Quote
 
Christopher Benson-Manica
Guest
Posts: n/a
 
      01-04-2006
Flash Gordon <(E-Mail Removed)> wrote:

> comp.programmer.unix


ITYM comp.unix.programmer?

--
Christopher Benson-Manica | I *should* know what I'm talking about - if I
ataru(at)cyberspace.org | don't, I need to know. Flames welcome.
 
Reply With Quote
 
tmp123
Guest
Posts: n/a
 
      01-04-2006

Flash Gordon wrote:
> tmp123 wrote:
> > (E-Mail Removed) wrote:
> >> now the problem is that if i use getc() the program execution stpos at
> >> this line and waits for the user to press a key. cant use getchar
> >> because the key pressed appears on the screen and moreover it is
> >> buffered.
> >>

> > Hi,
> >
> > As an starting point, can I suggest you to try the small program
> > below?.
> >
> > Kind regards.
> >
> > #include <stdio.h>
> > #include <sys/time.h>

>
> This is not a standard header.
>
> > struct timeval timeval_poll = {0,0};

>
> timeval is not part of stadnard C.
>
> > int main ( void )
> > {
> > fd_set i;

>
> <snip>
>
> fd_set is not part of standard C. In fact, most of what you have written
> is not standard C and not available on all platforms and so may not be
> available on the OPs platform and even if it is may not be the
> appropriate solution.
>
> You have been reading this group long enough to have seen advice on
> topicality, but once more, DON'T post off topic advice without at the
> very least redirecting the discussion to a more appropriate group where
> people that know about the matter will be able to review and comment on
> your advice.
> --


It is not an answer (a 5 lines program can not be), it is a pointer.
It is the OP who must decide if follow it and collect more information
about, if applicable, ... . In this way, and together with the groups
that has been pointed there are a starting point. Can be in this group
there are not BSD/POSIX/... specialist, but at least there are enough
knowledgment to point a few of posible continuation lines that unblocks
a situation and helps a colleague.

 
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
peek at stdin, flush stdin Johnathan Doe C Programming 5 05-17-2013 04:30 PM
How to pass stdin of a C++ program to the stdin of a process createdwith ShellExecute() Ben C Programming 2 08-29-2009 09:47 PM
STDIN, OUT, ERR and $stdin, out, err - Differences? Terry Cooper Ruby 7 06-09-2009 05:48 AM
Reading from stdin then launching a program that reads from stdin strange behaviour Stefano Sabatini Perl Misc 6 07-29-2007 10:38 PM
Reading stdin once confuses second stdin read Charlie Zender C Programming 6 06-21-2004 01:39 PM



Advertisments