Hi all,
Can anyone tell me a little about the datatype FILE, which represents stream. What does its structure look like, and in which header file is it defined and so on...
Ex :
FILE *fp ;
fp = fopen("filename", "w") ;
Hi all,
Can anyone tell me a little about the datatype FILE, which represents stream. What does its structure look like, and in which header file is it defined and so on...
Ex :
FILE *fp ;
fp = fopen("filename", "w") ;
it is in stdio.h
typedef struct {
unsigned char *_ptr;
int _cnt;
unsigned char *_base;
unsigned char *_bufendp;
short _flag;
short _file;
int __stdioid;
char *__newbase;
#ifdef _THREAD_SAFE
void *_lock;
#else
long _unused[1];
#endif
#ifdef __64BIT__
long _unused1[4];
#endif /* __64BIT__ */
} FILE;
thanks for the answer, but when I go in the stdio.h file, there's no such definition. Instead, there's a statement like :
using std::FILE ;
where is std?
The standard C++ namespace.
yes, i know, it's c++ namespace, but how can I can and view what is inside the namespace, where is that std file?
hi
the std-namespace must also be defined somewhere.
in solaris stdio.h includes iso/stdio_iso.h where the c++-namespace std is defined.
the gnu c-compiler (gcc) has the flag -E which only applies the c-preprocessor and writes the generated text to the output. preprocessor output is described in http://www.delorie.com/gnu/docs/gcc/cpp_47.html
whicth this output you can see all macro-definitions expanded and from where they come from. perhaps other compilers have similar options.
guenter
if not solaris,
try /usr/include/stdio.h
this path is common on most Linx distro's