Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

what is file * in stdio.c souce file in glibc that has & operator

#include "stdio.h"

#undef stdin
#undef stdout
#undef stderr
FILE *stdin = (FILE *) &_IO_2_1_stdin_;
FILE *stdout = (FILE *) &_IO_2_1_stdout_;
FILE *stderr = (FILE *) &_IO_2_1_stderr_;

What do these file * lines mean in the stdio.c file in glibc source code, what does the & operator mean in the last three lines. what is IO_2_1_stdin, is it a file or what does & operator mean in that line?

>Solution :

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

stdin, stdout and stderr are the standard streams required by the spec. These are their definitions. Each points to a matching implementation-defined structure – in this case, those structures are global variables named _IO_2_1_stdin_, etc. The & is the normal address-of operator.

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading