example of netStatus

I am once again, play with the netstatus example.  I continue with trying to access the interface details using:

typedef struct netstatus_interface_details_t netstatus_interface_details_t;

and this

int netstatus_get_interface_details (const char * interface, netstatus_interface_details_t * details);

When I try to allocate the structure on the stack, I get the following error:

netstatus_interface_details_t details [10];  error: array type has incomplete element type

What Miss me?

Something like that

struct TestStruct
{
tank has [20];
int b;
};

typedef struct TestStruct TestStruct;

TestStruct Array [10];

compiles with gcc

Aside: I chose 10 because it is larger than the number of interfaces found previously.

netstatus_interface_details_t is an opaque structure.  Its content is not declared in the header file so that the compiler does not know its size.  You use it as:

netstatus_interface_details_t * details;
int rc = netstatus_get_interface_details (interface, & details);
If (rc! = BPS_SUCCESS) {}

/ * handle error * /.
} else {}

/ * use the Get accessor on the structure of details for example * /.

const char * name = netstatus_interface_get_name (details);

/ * release it when finished * /.

netstatus_free_interface_details(&Details);

}

Sound defined in this way so that adding additional members to interface details does not break backward compatibility.  netstatus_interface_list_t behaves differently because we do not see change in the future.

Tags: BlackBerry Developers

Similar Questions

Maybe you are looking for