0

On Windows, there's a command line tool named CLIP which copies input to the clipboard.

The help message for CLIP is as follows:

CLIP

Description:
    Redirects output of command line tools to the Windows clipboard.
    This text output can then be pasted into other programs.

Parameter List:
    /?                  Displays this help message.

Examples:
    DIR | CLIP          Places a copy of the current directory
                        listing into the Windows clipboard.

    CLIP < README.TXT   Places a copy of the text from readme.txt
                        on to the Windows clipboard.

If you run CLIP with no input, you get the following message:

C:\clip

INFO: Type "CLIP /?" for usage.

How is CLIP able to detect that it's not getting any input on stdin?

How would you write this check in C?

phaz
  • 872
  • 9
  • 23
  • 1
    Check out this question on stackoverflow: https://stackoverflow.com/questions/23164492/how-can-i-detect-if-there-is-input-waiting-on-stdin-on-windows – Jim Rhodes Nov 03 '18 at 22:30
  • Thanks. I think this one might also be viable: https://stackoverflow.com/questions/1312922/detect-if-stdin-is-a-terminal-or-pipe – phaz Nov 10 '18 at 13:43

0 Answers0