Durieux Jean-Marc wrote:
> 
> This is the definition of my struct :
> 
> typedef struct _CODE_POSTAL

Names starting with _[A-Z] are reserved to the C++ implementation. You
mustn't use them in your code.

> {
>  UInt32 dwCode;
>  Char *szCommune;
>  UInt8 iIndex;
> }CODE_POSTAL, *PCODE_POSTAL;
> 
> And this is the declaration of my table :
> 
> CODE_POSTAL CodesPostaux[TAB_COMMONS]=
>     {
>     {9420 ,"Aaigem"},

This initializes a Char * with an array of constant characters. You should
change szCommune's type:

Char const *szCommune;


> But when I try to load a value in the table (CodesPostaux[i].szCmmune,
> for exemple), I've an error ...

I can't reproduce this. If I do this

typedef struct
{
  UInt32 dwCode;
  Char const *szCommune;
  UInt8 iIndex;
}CODE_POSTAL, *PCODE_POSTAL;

CODE_POSTAL CodesPostaux[]=
{
  {9420 ,"Aaigem"},
  {8511 ,"Aalbeke"},
  {9300 ,"Aalst"},
  {3800 ,"Aalst"},
  {9880 ,"Aalter"},
  {3200 ,"Aarschot"},
  {8700 ,"Aarsele"},
  {8211 ,"Aartrijke"},
  {2630 ,"Aartselaar"},
  {4557 ,"Ab�e"}
};

, I have no problem popping up a form displaying CodesPostaux[3].szCommune.
In contrary to the other posters, I don't see the need for reserving memory
inside the struct, a pointer should work just fine. What do you do (code)
to create the error? What error do you get?

-- 
For information on using the Palm Developer Forums, or to unsubscribe, please see 
http://www.palmos.com/dev/tech/support/forums/

Reply via email to