Hey, I wander if it is possible to use file types like: .info, .settings, .xlm, .properties or .ylm in a standard win32 program (without using "#include <fstream>") for settings?
Implement settings?
Collapse
X
-
fstream is a C++ I/O library. It has nothing to do with win32. File names in win32 are internally mapped to a value used by Windows. Your file names can be anything you want -
Actually, fstream has a buried FILE* used in C. Plus it also uses other file functions from C. fstream is a template that wraps C file I/O and is designed for speed. It also makes file handling consistent rather then having each program use home-grown file handling code.
You can, of course, write your own I/O code but it will not be any faster and it will be incompatible with code written by other programmers, which will make your code harder to maintain.
What I would do is write a C++ class to do your file I/O and use fstream inside that class. The member functions of the class will not expose and fstream code. Then write the rest of your program using only member functions from this class. After your program is working and fully debugged and you still don't like fstream, then return to this class, gut the insides, and replace them with your own FILE* code--if you have the energy and the budget.Comment
-
I'm confused. The size of header files has nothing to do with the size of your program. The only functions that end up in your executable are the ones you called.
Since each source file is separately compiled you include the complete set of headers in each source file. Massive headers just mean the build takes longer.
So what you do mean exactly?
Nothing in a header file allocates memory. The are declarations only.Comment
-
A Windows resource is designed to be used by all developers so that all programs work the same. A settings files does not need to be efficient in terms of adding/removing values. It just has to be fast when a program reads the settings.
I suppose you could start from scratch, design your own settings file and then write code (hopefully no graphic interface code) to manage a file of settings. You might even try coming up with your own parse rules for fetching the settings. Then you could decide to write the management code in either structure or object oriented format. With a 2gz+ processor even the worst code will run liked greased lightning.
Its reinventing the wheel.
If you are writing for Windows, then stick with the tools provided in the win32 SDK. Other operating systems have their own preferred settings file format and you should use that on those OSs'.
Efficiency is not the game these days. A completed program coded in minimum time reusing previously written code is where the action is.Comment
Comment