[Date Prev][Date Next] [Thread Prev][Thread Next]
[Date Index] [Thread Index] [New search]

Re: FDK Help with Arrays



On Thu, 18 Oct 2001 16:04:50 -0500, "Rick Quatro" <rick@frameexpert.com> 
wrote:

>I am trying to use an array of integers in an API client. I am declaring it
>like this:
>
>IntT vColFlags[15];
>
>Then I am using standard C notation for accessing the members of the array.
>
>vColFlags[12] = 1;
>
>Is this legal or is there another way to declare and use integer arrays in
>the FDK? Thanks in advance.

Looks perfectly legal to me; the FDK just uses regular C.  If you
have a problem, you can send me the source off-list and tell me
what it's doing wrong...  ;-)

If you don't know the size until runtime, you can always declare
a pointer and allocate memory when you know what you need:

 IntT *vColFlags = NULL;
 ...
 vColFlags = F_Alloc(nColCount, NO_DSE); // and check for NULL...
 ...
 vColFlags[nCurrCol] = 1;
 ...
 F_Free(vColFlags);

Also, be careful not to confuse an array of ints with:

 typedef struct {
     UIntT len;
     IntT *val;
 } F_IntsT;

which is returned by various FDK functions such as F_ApiGetInts()
and must of course be handled quite differently:

 F_IntsT MyIntData;
 ...
 MyIntData = F_ApiGetInts(...);
 ...
 MyIntData.val[nItemNum] = 1;
 ...
 F_ApiDeallocateInts(&MyIntData);

HTH!

-- Jeremy H. Griffith, at Omni Systems Inc.
  (jeremy@omsys.com)  http://www.omsys.com/

** To unsubscribe, send a message to majordomo@omsys.com **
** with "unsubscribe framers" (no quotes) in the body.   **