Re: WinCE Struct Help

From: Vin (Vin_at_discussions.microsoft.com)
Date: 03/23/05


Date: Wed, 23 Mar 2005 07:37:01 -0800

Man this is a tough area to ask for help. I asked a simple question and
instead of getting a simple helpful hints or example, I got a lecture about
courses in college. Dang it must been almost 20 years since I was in program
101. I don't live inside of books. At times I forget simple things, and that
is why I am here.

I know that you guys are gurus at these things, but when you read these
posts put yourself in these people's shoe. We are not gurus like you guys.
Some of us just started programming while others are more advanced. We all
can't be like you or wanted to be like you guys.

thanks for the help :)

"Todd Krochta" wrote:

> I think what Phil means is that what you're talking about doing would be
> solved by implementing a linked list or some other basic programming
> structure which uses dynamic list allocation and deallocation. This type of
> programming ("Intro to Data Structures") is usually covered very early on in
> a software engineering ciriculum.
>
> --
> Todd Krochta
> Applied Data Systems
>
>
> "vin" <vin@discussions.microsoft.com> wrote in message
> news:B063B28F-1DA5-472B-ACB5-49F253547F7B@microsoft.com...
> > Hi Phil,
> >
> > what do you mean basic concept of malloc and realloc?? I know how to use
> > these functions. But I want to use struct. Are you saying that we can use
> > malloc or realloc function for struct?
> >
> > some example would be great.
> >
> > "Phil Frisbie, Jr." wrote:
> >
> >> Vin wrote:
> >>
> >> > Hi,
> >> >
> >> > I developed an application using WinCe 4.0 for Pocket PC 2002.
> >> >
> >> > I have defined a struct as global:
> >> >
> >> > //events struct
> >> > struct EVENTS
> >> > {
> >> > long m_eventID;
> >> > BYTE m_pubKey[148];
> >> > ULONGLONG m_openGate;
> >> > ULONGLONG m_closeGate;
> >> > };
> >> > EVENTS events[25];
> >> >
> >> > I have allocated 25 arrays for this struct. My goal is to use this
> >> > struct to
> >> > hold data for at least 25 events.
> >> >
> >> > My question are:
> >> > 1. is this how I go about doing it?
> >>
> >> It is one way.
> >>
> >> > 2. Can I reallocat or expand this struct to more than 25 arrays later
> >> > on in
> >> > the program?
> >>
> >> No.
> >>
> >> > If I need to hold 40 events info, can I expand it? if so, would
> >> > you please give me a code example of doing it?
> >>
> >> No. This is VERY basic C programming. Look up malloc() and realloc() in
> >> your
> >> compiler documentation.
> >>
> >> > Many Thanks
> >>
> >> --
> >> Phil Frisbie, Jr.
> >> Hawk Software
> >> http://www.hawksoft.com
> >>
> >>
>
>
>



Relevant Pages

  • Re: reading from a serial port
    ... >> array of structs, it uses a pointer to one element in an array ... >far enough to know that FILE is possibly a typedef to some struct. ... Ritchie, "The C Programming Language", 2nd Edition. ... the stdio library allocates a data buffer (BUFSIZ in stdio.h is ...
    (comp.unix.programmer)
  • Re: Pointers, structs and memory allocations
    ... > lots of pointers and pointers to pointers which makes me confused. ... Hiding structs behind typedefs is only a good idea if the struct needs ... Casting malloc is a no no, ... for lists that are pretty short. ...
    (comp.lang.c)
  • Malloc statistics patch
    ... Now that the UMA changes to use critical sections instead of per-cpu mutexes ... memory allocation patch previous posted. ... - Introduce per-cpu malloc type statistics, ... - If we're willing to abandon 5.x backport, we can clean up 'struct ...
    (freebsd-performance)
  • Re: Something wrong in my program
    ... I'm sorry to post such programming misbehaviours, ... > Régis Troadec wrote: ... > malloc() returns NULL you will attempt to access memory you don't own. ... mallocimplicitly returns an int. ...
    (comp.lang.c)
  • Re: Avoiding malloc
    ... For a resource constrained embedded system I want to avoid malloc. ... typedef struct foo_fake foo_t; ... expose code that is peeking: ...
    (comp.lang.c)