🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

Opening files

Started by
3 comments, last by Slayer-X 24 years, 7 months ago
I just use good old DOS fopen.

------------------
- mallen22@concentric.net
- http://members.tripod.com/mxf_entertainment/

Advertisement
I use either ifstream and ofstream or fopen.

------------------

fopen and fscanf / fprintf for reading and writing.
I'm just wondering how most of you open files, I know how I just want to see what the fastest and most common way is.
If you're using Windows and you want speed the Win32 API functions CreateFile, ReadFile, WriteFile should be fastest. All the other options (fopen/istream/whatever) call on the services of these functions at some point. The only thing to watch is that they aren't buffered. So if you make lots of short reads or writes it will go SLOOOOOWWWWWW!

If I want speed and buffering, I use CreateFileMapping and MapViewOfFile. These allocate a file into the process's address space so you can access it through a pointer. Its kind if like turning the file into a second swapfile.

This topic is closed to new replies.

Advertisement