Hello Bj�rn,
Saturday, November 30, 2002, 2:29:44 AM, you wrote:
BP>>> [ Frage beanwortet, die schon l�ngst beanwortet worden ist ]
BP> [...]
BP> Oder was mit typedef, das macht die Sache deutlich
BP> �bersichtlicher...
BP> #define BLK_SIZE 64
BP> typdef short DCT_TYPE;
BP> typedef short[BLK_SIZE] DCT_BLOCK;
^^^^^
Soll wohl eher typedef DCT_TYPE DCT_BLOCK [BLK_SIZE]; hei�en?
BP> typedef DCT_BLOCK* DCT_DATA;
BP> Und dann so was wie
BP> DCT_DATA data = cmalloc( size, BLK_SIZE);
^^^^^^^^^^^^^^^^^^^^^^^^
calloc(nmemb, sizeof(DCT_BLOCK));
Da es jedoch dynamisch sein soll, mal ein kl. Beispiel:
...
typedef short DCT_TYPE;
typedef DCT_TYPE DCT_BLOCK [BLK_SIZE];
typedef DCT_BLOCK* DCT_DATA;
...
int cur, max;
DCT_DATA tmp, data = NULL;
...
for (cur=0, max=0; ;cur++) { /* Schleife, in der mit DCT_DATA gearbeitet werden soll */
if (cur >= max) {
max += 50;
data = realloc(data, max*sizeof(DCT_BLOCK));
tmp = data+(max-50);
memset(tmp, (int) NULL, 50*sizeof(DCT_BLOCK));
}
...
}
...
--
cheers,
Tobias
----------------------------------------------------------------------------
PUG - Penguin User Group Wiesbaden - http://www.pug.org