Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9110559
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T03:17:55+00:00 2026-06-17T03:17:55+00:00

Is there a portable way to read data from stdin without blocking, or to

  • 0

Is there a portable way to read data from stdin without blocking, or to check if data is available to be read without blocking? Keep in mind stdin could be piped from another process, not just be terminal/keyboard input.

Best would be only using ANSI C function from stdlib.h or stdio.h, but using POSIX functions would be very portable too.

Also I’m not sure about this, but there are some forum posts where they say select() wouldn’t work on Windows in practice.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T03:17:56+00:00Added an answer on June 17, 2026 at 3:17 am

    select() and poll() are the POSIX way, but they won’t work on Windows for non-sockets.

    If Windows and Unix are both your targets, there’s no way portable enough. Even more, on Windows you have to handle pipes and console handles separately: PeekNamedPipe() for pipes, PeekConsoleInput() for console (and it’s rather complicated with the latter even if you don’t have ENABLE_LINE_INPUT, turning to a real can of worms if you do).

    Doing input in a separate thread is more portable, even with pthread vs. Windows differences (and there are pthread-for-Win32 libraries to get rid of those differences).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Is there a portable way to run a python script from a shell without
Is there a portable way of monitoring a file for changes from a deployed
Is there a (portable) way to rotate text in a HTML table cell by
Is there a portable way to convert a UTF-8 string in C to upper
Is there any portable (Windows & Linux) way of counting how many milliseconds elapsed
Is there a portable way to request a Servlet container to shutdown gracefully ,
Is there a portable way to load the C standard library ( libc.so ,
Is there a portable way in C to find out the mask for a
Is there any portable way to determine what the maximum possible alignment for any
Possible Duplicate: Is there a portable way to get the current username in Python?

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.