please tell a details of the structure of a file pointer defined in stdio.h.please describe the macros used here.
please tell a details of the structure of a file pointer defined in stdio.h.please describe the macros used here.
The details are compiler/library dependent.
From a perspective of C as a language (eg the C standard) the FILE pointer is essentially an opaque type - programmers rarely need to know the details.
If you do need to know the details, simply examine the stdio.h that comes with your compiler. Just keep in mind that the details will be different for another compiler (or even, potentially, for a different version of your compiler).
See the following code.
This is the predefine FILE structure. in stdio.h
Code:typedef struct { char *fpos; /* Current position of file pointer (absolute address) */ void *base; /* Pointer to the base of the file */ unsigned short handle; /* File handle */ short flags; /* Flags (see FileFlags) */ short unget; /* 1-byte buffer for ungetc (b15=1 if non-empty) */ unsigned long alloc; /* Number of currently allocated bytes for the file */ unsigned short buffincrement; /* Number of bytes allocated at once */ } FILE;
Last edited by ungalnanban; 03-03-2010 at 11:54 PM.
You can see the details in this file /usr/include/libio.h
Refer this site for more details
http://tigcc.ticalc.org/doc/stdio.html#FILE
Last edited by Alexander jack; 03-03-2010 at 11:55 PM.
Just note that the preceding two posts are specific to a particular compiler and/or library. If your compiler/library differs from the ones used by ungalnanban or Alexander jack, then the contents of stdio.h may differ (and usr/include/libio.h may not even exist).
grumpy is right , I gave solution for GCC 4.1.2.
may I know which compiler u r Mr.u.unmesh?
You can use any compiler , but I hope that there is no big and notable difference would be
there in the structure of FILE. I am very sure that the link itself will give you a clear picture