Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17


Best method for storing/accessing data?

Posted on 1999-06-22
Medium Priority
Last Modified: 2013-11-20
I'm new to C++.  My application needs to read and write a data file containing hundreds of different values.  I want to access those data from a couple dozen different dialog boxes.

What's the "best" way to do this in C++/MFC?  Should I create a class to hold the data, give it a couple hundred static members, and access each of them "globally" via something like CDataClass::m_fTime, CDataClass::m_fVelocity, etc.?

Or is there a better way using templates or MFC list collection classes?
Question by:SixString
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions

Expert Comment

ID: 1307680
One "best" method is to create an ODBC data source and use the CRecordset class to access/manipulate it.  If you do this, you can keep your data integrity and access the data through various methods. Hines@SprintMail.COM

Author Comment

ID: 1307681
This isn't really database-type data.  It's a large FORTRAN input data file that will be accessed via a bunch of different dialogs.  I need to store all the disparate data in one area for manipulation.

Accepted Solution

EuchreMan earned 280 total points
ID: 1307682
Make a data class for each of the dialogs and store the
dialog-specific data there.

Create a global CObject list with pointers to those data objects.

Use AddList to add each dialog's data to it as you OK out
of each dialog.

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction: Hints for the grid button.  Nested classes, templated collections.  Squash that darned bug! Continuing from the sixth article about sudoku.   Open the project in visual studio. First we will finish with the SUD_SETVALUE messa…
If you use Adobe Reader X it is possible you can't open OLE PDF documents in the standard. The reason is the 'save box mode' in adobe reader X. Many people think the protected Mode of adobe reader x is only to stop the write access. But this fe…
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…

704 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question