FILE object in C/C++

hi all,

I spent a long time to study Stream in C/C++. and as i know, FILE is a object to control a Stream.
There are many different define of FILE, one of these defination is as at : http://tigcc.ticalc.org/doc/stdio.html#FILE

In above FILE definition, there has a member in FILE is :

unsigned short handle; /* File handle */

What's a File handle ? Is it a function pointer ? how people can write the characters to FILE object ? for example, how to printf function can write characters to stdout stream ?

Thanks
FILE is an ANSI C structure is used for file handling. C++ provides the I/O stream library.

The actual file I/O is done by making system calls. On UNIX the system call open return an int. On Windows the system call OpenFile returns a HANDLE. The handle type can be different for each operating system. The type of the handle will match what the OS uses.
so, If I remember correctly, a file descriptor ( unsigned short handle; ) is basically just an integer. I imagine that it is an index into a table somewhere ?

Thanks
On Unix it is, yes. But that's not generally true.
Topic archived. No new replies allowed.