Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What's the int macro for stdin?

Tags:

c

macros

stdin

stdin is of type FILE *,

is there a fd macro for it?

Or do I need to convert it myself?

like image 939
R__ Avatar asked Jul 05 '11 13:07

R__


People also ask

Is stdin a macro?

Since the symbols stdin, stdout, and stderr are specified to be macros, assigning to them is nonportable.

What is the value of stdin?

Standard input value stdin. Its value is 0.

What does stdin do in Linux?

In Linux, stdin is the standard input stream. This accepts text as its input. Text output from the command to the shell is delivered via the stdout (standard out) stream. Error messages from the command are sent through the stderr (standard error) stream.


3 Answers

STDIN_FILENO from unistd.h

like image 154
Nikolai Fetissov Avatar answered Oct 13 '22 17:10

Nikolai Fetissov


fileno(stdin)

like image 42
robert Avatar answered Oct 13 '22 16:10

robert


The following are the integer file descriptors for the standard streams:

  • 0: stdin
  • 1: stdout
  • 2: stderr
like image 2
user7116 Avatar answered Oct 13 '22 16:10

user7116