Click here to Skip to main content
16,013,516 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Read / Write Registry Pin
Lucky the code machine29-May-02 7:17
Lucky the code machine29-May-02 7:17 
GeneralRe: Read / Write Registry Pin
Martin Ziacek29-May-02 7:28
Martin Ziacek29-May-02 7:28 
GeneralRe: Read / Write Registry Pin
Lucky the code machine30-May-02 2:15
Lucky the code machine30-May-02 2:15 
GeneralRe: Read / Write Registry Pin
Martin Ziacek29-May-02 7:31
Martin Ziacek29-May-02 7:31 
GeneralRe: Read / Write Registry Pin
Lucky the code machine29-May-02 7:29
Lucky the code machine29-May-02 7:29 
GeneralWindow Programming (Saving Results) Pin
29-May-02 7:01
suss29-May-02 7:01 
GeneralRe: Window Programming (Saving Results) Pin
Nish Nishant29-May-02 7:02
sitebuilderNish Nishant29-May-02 7:02 
GeneralCount Number of Items in a struct Pin
Anton A. Loukine29-May-02 6:36
Anton A. Loukine29-May-02 6:36 
What I am trying to do may be considered mental mastrubation, but here is the question:

can I programmatically:
- count the number of items in a structure;
- get access to any of the items by its index (but not by its name) while presersing the names of these items.

The following example should make it clear:

I have a struct:

struct BBG_SECURITIES {
long nRecords; // Number of Entries
CStringArray sName; // Security Name
CStringArray sTicker; // Security Ticker
CStringArray sMarket; // Security Market
CStringArray sIssuer; // Issuer
CStringArray sCoupon; // Coupon
CStringArray sFrequency; // Frequency
CStringArray sMaturity; // Maturity Date
CStringArray sCurrency; // Currency
CStringArray sCountry; // Country
CStringArray sDBRS; // DBRS Bond Rating
CStringArray sSP; // S&P Bond Rating
CStringArray sMoody; // Moody's Bond Rating
CStringArray sBloomberg; // Bloomberg Composite Bond Rating
};

And I am lazy to write all of that each time:

m_strCurrentUniverse
.nRecords = NULL
.sName.SetSize(0)
.sTicker.SetSize(0)
.sMarket.SetSize(0)
.sIssuer.SetSize(0)
.sCoupon.SetSize(0)
.sFrequency.SetSize(0)
.sMaturity.SetSize(0)
.sCurrency.SetSize(0)
.sCoutry.SetSize(0)
.sDBRS.SetSize(0)
.sSP.SetSize(0)
.sMoody.SetSize(0)
.sBloomberg.SetSize(0);

What I want to set up some kind of a loop:
int nItems = GET ITEM COUNT IN THE STRUCT
for (i = 0; i < nItems; i++) {
xxx = GET STRUCT ITEM
xxx.SetSize(0);
}

Any thoughts?

Thank you.
GeneralRe: Count Number of Items in a struct Pin
Rama Krishna Vavilala29-May-02 6:49
Rama Krishna Vavilala29-May-02 6:49 
GeneralRe: Count Number of Items in a struct Pin
Anton A. Loukine29-May-02 6:49
Anton A. Loukine29-May-02 6:49 
GeneralRe: Count Number of Items in a struct Pin
Rama Krishna Vavilala29-May-02 7:23
Rama Krishna Vavilala29-May-02 7:23 
GeneralRe: Count Number of Items in a struct Pin
Rama Krishna Vavilala29-May-02 6:55
Rama Krishna Vavilala29-May-02 6:55 
GeneralRe: Count Number of Items in a struct Pin
Anton A. Loukine29-May-02 6:50
Anton A. Loukine29-May-02 6:50 
GeneralRe: Count Number of Items in a struct Pin
Joaquín M López Muñoz29-May-02 8:47
Joaquín M López Muñoz29-May-02 8:47 
GeneralRe: Count Number of Items in a struct Pin
Michael Dunn29-May-02 17:56
sitebuilderMichael Dunn29-May-02 17:56 
GeneralTrick or thread Pin
Zizilamoroso29-May-02 6:24
Zizilamoroso29-May-02 6:24 
GeneralRe: Trick or thread Pin
Rama Krishna Vavilala29-May-02 6:50
Rama Krishna Vavilala29-May-02 6:50 
GeneralRe: Trick or thread Pin
Zizilamoroso29-May-02 7:03
Zizilamoroso29-May-02 7:03 
GeneralRe: Trick or thread Pin
Nish Nishant29-May-02 7:14
sitebuilderNish Nishant29-May-02 7:14 
GeneralRe: Trick or thread Pin
Zizilamoroso29-May-02 8:11
Zizilamoroso29-May-02 8:11 
QuestionScroll in ListControl ? Pin
dlhson29-May-02 5:50
dlhson29-May-02 5:50 
AnswerRe: Scroll in ListControl ? Pin
Prem Kumar29-May-02 6:14
Prem Kumar29-May-02 6:14 
QuestionHow does a modal dialog work (message pump)? Pin
29-May-02 4:29
suss29-May-02 4:29 
AnswerRe: How does a modal dialog work (message pump)? Pin
Joaquín M López Muñoz29-May-02 4:58
Joaquín M López Muñoz29-May-02 4:58 
GeneralRe: How does a modal dialog work (message pump)? Pin
Maximilien29-May-02 5:30
Maximilien29-May-02 5:30 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.