version 2003
PA_GetResourceIDList (resFile; kind; IDlist) long
Parameter | Type | Description | |
resFile | short | File reference number of the file to access | |
kind | unsigned long | Kind (4 Bytes type) of resource to access | |
IDlist | short* | Array of IDs | |
Function result | long | Number of IDs of a type |
Description
The routine PA_GetResourceIDList fills the buffer pointed to by IDlist with all IDs of the resources of type kind found in the file referenced by resFile, and then returns the number of resources.
WARNING
The returned value is not the size of the data pointed to by IDlist, but the count of IDs in the array.
First call the routine passing 0L in IDlist to get the count of resources. Then, allocate a buffer of (thisCount * sizeof(short)) and call the routine again.
If there is no resources of type kind, the routine returns 0.
Example
Get the IDs of resource 'toto' and loop the IDs.
short *IDs; long count, i; PA_Handle h; count = PA_GetResourceIDList(resFile, 'titi', 0L); if(count) { IDs = malloc(count * sizeof(short)); if(IDs) { count = PA_GetResourceIDList(resFile, 'titi', IDs); for(i = 0; i < count; i++) { h = PA_GetResourceHandle(resFile, 'titi', IDs[i]; /* . . . do something with the resource . . .*/ } } free(IDs); }
See Also
PA_GetResourceKindList, PA_GetResourceNameList.
Error Handling
Use PA_GetLastError to see if an error occurred