In memory INI File Writer

I have an MFC application that is wizard based. The application prompts the user for a variable number of questions, which are then written to an INI file, which is later encrypted when the user clicks the Finish button.

All INI file parsers I've seen so far read from or write to a physical file on disk. I don't want to do this as the INI file contains confidential information. Instead, I would like the INI file to be in-memory-only based and never written to disk unencrypted.

As the app allows users to go back and change responses, it occurred to me that I could use an in-memory database for this purpose, but again I don't want anything to be written to disk and don't need to send the DB using mine application if it can be avoided.

I need to use an INI file as it is not processed by a unencrypted file by a third party.

Any suggestions are greatly appreciated.

Thanks..

0


a source to share


4 answers


I have a C ++ IniFile class that allows working with Ini files in memory: http://www.lemonteam.com/downloads/inifile.h

It is a short, well-documented single .h file. Using example:



IniFile if ( "myinifile.ini" );

if.SetString( "mykey", "myvalue" );


// Nothing gets actually written to disk until you call Flush(), Close() or the object is deleted
if.Flush();
if.Close();

      

You should be able to modify the Flush () method to apply some kind of encryption to the stored data.

+3


a source


Sounds like a good memory mapped file application, as you can control when your in memory view is flushed back to a file on disk.



0


a source


Why would you need to have it in ini file format if it is never stored on disk?

Why not just store it in memory as a data structure and use the normal ini file methods to write to disk whenever you want.

0


a source


If you don't want to save to a file, what is the point of using an INI file? INI API is a basic pair of property bags or keys based on disk file. If you don't want to use the file, I suggest you use your own hash or dictionary structure to store the parirs key value

0


a source







All Articles