Thursday 31 January 2013

File Programming in C: PART - 2

Consider the Program given below. The program prints the values of member variables in the FILE structure of UNIX.

#include<stdio.h>

int main()
{
     FILE * fp;
     fp=fopen("File2.C","r");

     printf("\nThe File Structure Values are:\n");
     printf("\n_ptr = %d",fp->_ptr);
     printf("\n_cnt = %d",fp->_cnt);
     printf("\n_base = %d",fp->_base);
     printf("\n_flag = %d",fp->_flag);
     printf("\n_file = %d",fp->_file);

     fclose(fp);
}


The program prints the values of the member variables in the FILE structure.

_ptr :-   Next Character in Buffer.
_cnt :-   Number of available characters in Buffer.
_base :- The Buffer.
_flag :-  The state of the stream.
_file :-   Unix system file descriptor.

  
Click here to download the C Program to print the FILE Structure member variables.

No comments:

Post a Comment