Programming Reference/Librarys
Question & Answer
Q&A is closed
FILE Pointer (stream) shows on a given file The data type FILE is a structure that contains information about a file or specified data stream. It includes such information as a file descriptor, current position, status flags, and more. It is most often used as a pointer to a file type, as file I/O functions predominantly take pointers as parameters, not the structures themselves (see example below).
#include <stdio.h> /* including standard library */ //#include <windows.h> /* uncomment this for Windows */ int main (void) { FILE *filestream; filestream=fopen("test.txt","r"); if (filestream == NULL) perror("cannot open file"); fclose(filestream); return 0; }