what's the difference between wxFile and wxFFile? Topic is solved

If you are using the main C++ distribution of wxWidgets, Feel free to ask any question related to wxWidgets development here. This means questions regarding to C++ and wxWidgets, not compile problems.
Post Reply
hongxing
Filthy Rich wx Solver
Filthy Rich wx Solver
Posts: 227
Joined: Mon Aug 01, 2005 10:04 am

what's the difference between wxFile and wxFFile?

Post by hongxing »

and which class shoud I use?

thanks!
Mahr
Experienced Solver
Experienced Solver
Posts: 75
Joined: Fri Aug 26, 2005 10:27 am

Post by Mahr »

  • wxFFile implements buffered file I/O

    It wraps inside it a FILE * handle used by standard C IO library.
What to use I think depends on what you want to do with[/list]
Damage controll is easy, reading Klingon that's hard
hongxing
Filthy Rich wx Solver
Filthy Rich wx Solver
Posts: 227
Joined: Mon Aug 01, 2005 10:04 am

for example?

Post by hongxing »

in which case I should use wxFFile? is its performance better?

thanks
ssigala
Earned some good credits
Earned some good credits
Posts: 109
Joined: Fri Sep 03, 2004 9:30 am
Location: Brescia, Italy

Re: for example?

Post by ssigala »

hongxing wrote:in which case I should use wxFFile? is its performance better?

thanks
wxFile wraps around "classic unix" i/o style functions, i.e. open(), close(), read(), write() etc.
wxFFile wraps around standard C i/o, i.e. fopen(), fclose(), fread(), fwrite() etc.

The standard C functions provide natively buffered i/o, so they *should* be faster than raw i/o, expecially if you are reading/writing small pieces of data (a character at once, for example).

Apart of that, please note that the ::Eof() function behaviour of the two classes is different:
wxFFile::Eof returns true if an attempt has been made to read past the end of the file;
wxFile::Eof returns true if the end of the file has been reached (before reading past the end).
Sandro Sigala - Kynosoft, Brescia
Post Reply