Re: Array Manipln

From: Joseph M. Newcomer (newcomer_at_flounder.com)
Date: 02/24/04


Date: Tue, 24 Feb 2004 12:11:17 -0500

Without knowning what you mean by "record" makes it a little hard.

If you stick with MFC, CArray will work.

If you have a typedef that defines the record format, an array of these, or an array of
pointers to these, will work just fine

typedef struct {
       ....whatever
} MyRecord;

CArray<MyRecord, MyRecord &> records;
or
CArray<MyRecord *, MyRecord *> records;

will work. It just depends on whether you want to store the struct or a pointer to the
struct. in the array.

Or you could use STL classes.
                                joe

On Tue, 24 Feb 2004 03:06:05 -0800, "NoviceJohn" <anonymous@discussions.microsoft.com>
wrote:

>Hi
>i would like to know how to enter values from a file containing many records into an array ? which MFC class to use???
>and how????

Joseph M. Newcomer [MVP]
email: newcomer@flounder.com
Web: http://www.flounder.com
MVP Tips: http://www.flounder.com/mvp_tips.htm



Relevant Pages

  • Re: Errors with typedefs
    ... a series of variable declarations, ... C's "typedef" does not define types at all. ... It does this by requiring the "struct" keyword each time. ... Note that the "value" of an array is a pointer to its first element, ...
    (comp.lang.c)
  • Re: pointer to array of const objects
    ... > encapsulate an array inside a struct. ... "typedef" only creates an alias. ... anywhere in the conversion process. ...
    (comp.lang.c)
  • Re: How to assign memory dynamically to a array of structures
    ... Your struct tag "hom_id" is the same as the name of one of your struct ... If you insist on using a typedef for your structure, ... I want to know how to assign memory to this array of structure at ... You can either use mallocto allocate an array, ...
    (comp.lang.c)
  • Re: Passing an array of structuresfrom a pointer?
    ... to only declare structs in headers and then define the ... the struct should be declared ... what if you have a simple array like this: ... In the header we would declare? ...
    (microsoft.public.vc.language)
  • Re: Passing an array of structuresfrom a pointer?
    ... I've tried an attempt to do that, and I tried to "clean" the header and main ..c file. ... int LIST_NUMBER; ... typedef struct ddListBox{ ... DDLB_COLL1array! ...
    (microsoft.public.vc.language)