Mail Archives: djgpp/1997/06/04/05:31:02
> To call the function fstat will I have to re-open the given file
> using the "old" C FILE method or is there a way to do so with
> the already open file stream?
1. you can do in with 'stat' and supplying a filename.
2. if the file is already open there's a better way:
remember that any i/ofstream object has a pointer to
a 'filebuf' object (the one that does the real job)
you access this function with rdbuf().
Example:
ofstream fout("file.ext");
int fd = fout.rdbuf()->fd(); // returns EOF if file
isn't open.
// now you can use all the C functions that take file
descriptor.
fstat(fd, .....);
Eyal.
- Raw text -