abhaystp
abhaystp

Reputation: 3

"gets stdin" is not waiting for user input and exits

I am working on some TCL script where i want the user to enter his choice from the given list of OPTIONS.

I am using "gets stdin" for the user input. But my opened terminal is not waiting for user input and just exists.

Input → gets stdin abc
Output → -1

Upvotes: 0

Views: 565

Answers (1)

Schelte Bron
Schelte Bron

Reputation: 4813

The -1 indicates that either EOF was reached on stdin, or that your stdin is in non-blocking mode. You can check by running eof stdin and fconfigure stdin -blocking. On a normal terminal those commands should return 0 and 1 respectively.

To set stdin to blocking mode, you can use fconfigure stdin -blocking 1

Upvotes: 1

Related Questions