CoolInterview.com - World's Largest Collection of Interview Questions
Start Your Own website Now
Sponsored Links

Interview Questions
Our Services

Get 9,000 Interview Questions & Answers in an eBook.


  • 9500+ Pages
  • 9000 Question & Answers
  • All Tech. Categories
  • 14 MB Content

    Get it now !!



    Send your Resume to 6000 Companies


  • INTERVIEW QUESTIONS LANGUAGES C DETAILS
    Question :
    How can I find out if there are characters available for reading?
    Category C Interview Questions
    Rating (0.3) By 21 users
    Added on 11/17/2011
    Views 185
    Rate it!
    Answers:

    How can I find out if there are characters available for reading (and if so, how many)? Alternatively, how can I do a read that will not block if there are no characters available?

    These, too, are entirely operating-system-specific. Some versions of curses have a nodelay function. Depending on your system, you may also be able to use ``nonblocking I/O'', or a system call named select or poll, or the FIONREAD ioctl, or c_cc[VTIME], or kbhit, or rdchk, or the O_NDELAY option to open or fcntl. You can also try setting an alarm to cause a blocking read to time out after a certain interval (under Unix, look at alarm, signal, and maybe setitimer).
    If what you're trying to do is read input from several sources without blocking, you will definitely want to use some kind of a ``select'' call, because a busy-wait, polling loop is terribly inefficient on a multitasking system.



    If you have the better answer, then send it to us. We will display your answer after the approval.
    Rules to Post Answers in CoolInterview.com:-

  • There should not be any Spelling Mistakes.
  • There should not be any Gramatical Errors.
  • Answers must not contain any bad words.
  • Answers should not be the repeat of same answer, already approved.
  • Answer should be complete in itself.
  • Name :*
    Email Id :*
    Answer :*
    Verification Code Code Image - Please contact webmaster if you have problems seeing this image code Not readable? Load New Code
    Process Verification  Enter the above shown code:*
    Inform me about updated answers to this question

       
    Related Questions
    View Answer
    How can I display a percentage-done indication that updates itself in place, or show one of those twirling baton progress indicators?
    View Answer
    How can I make it pause before closing the program output window?
    View Answer
    How do I read the arrow keys? What about function keys?
    View Answer
    How can I do serial comm port I O?
    View Answer
    How can I direct output to the printe
    View Answer
    How do I send escape sequences to control a terminal or other device?
    View Answer
    How can I access an I O board directly?
    View Answer
    How can I do graphics in C?
    View Answer
    How can I send mail from within a C program?
    View Answer
    How can I check whether a file exists? I want to warn the user if a requested input file is missing.
    View Answer
    How can I find out the size of a file, prior to reading it in?
    View Answer
    How can I find the modification date and time of a file?
    View Answer
    How can I insert or delete a line (or record) in the middle of a file?
    View Answer
    How can I delete a file?
    View Answer
    How do I copy files?
    View Answer
    Why cant I open a file by its explicit path?
    View Answer
    fopen isnt letting me open files like "$HOME/.profile" and "~/.myrcfile".
    View Answer
    How can I increase the allowable number of simultaneously open files?
    View Answer
    How can I find out how much free space is available on disk?
    View Answer
    How can I read a directory in a C program?
    View Answer


    Please Note: We keep on updating better answers to this site. In case you are looking for Jobs, Pls Click Here Vyoms.com - Best Freshers & Experienced Jobs Website.

    View ALL C Interview Questions

    User Options
    Sponsored Links


    Copyright ©2003-2014 CoolInterview.com, All Rights Reserved.
    Privacy Policy | Terms and Conditions

    Download Yahoo Messenger | Placement Papers| FREE SMS | ASP .Net Tutorial | Web Hosting | Dedicated Servers | C Interview Questions & Answers

    Testing Articles | Testing Books | Testing Certifications | Testing FAQs | Testing Downloads | Testing Interview Questions | Testing Jobs | Testing Training Institutes


    Cache = 0.015625 Seconds