The MASM Forum Archive 2004 to 2012

General Forums => The Workshop => Topic started by: Danesh on June 14, 2005, 05:28:21 PM

Title: array of struct in assembly
Post by: Danesh on June 14, 2005, 05:28:21 PM
Hi all,

I have defined a struct as below:

DatabasesList Struc
DBName      DB      MaxLengthOfDBName   Dup(0)
         DB      0
DatabasesList EndS


now I want to define an array (lets say 10 elements) where each element be an instance of this struct. How can I do that ?

Rgds,

Danesh

Title: Re: array of struct in assembly
Post by: AeroASM on June 14, 2005, 05:40:05 PM

.data

MAX_LENGTH_OF_DB_NAME equ 63
NUMBER_OF_DATABASES equ 10

DatabaseList struct
    szDBName db MAX_LENGTH_OF_DB_NAME dup(0)
    db 0
DatabaseList ends

MyList DatabaseList NUMBER_OF_DATABASES dup(<>)
Title: Re: array of struct in assembly
Post by: Jeff on June 14, 2005, 05:51:18 PM
as a word of warning, you cannot use the DUP operator when making an array of structures that contains an array of structures (or at least no one seems to know how).

refer to this (http://www.masmforum.com/simple/index.php?topic=1700.0) thread.
Title: Re: array of struct in assembly
Post by: Danesh on June 15, 2005, 11:27:24 PM
Thanks, it seems the problem is solved.