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?