TIP: Click on subject to list as thread! ANSI
echo: power_bas
to: ALL
from: MARC VAN DEN DIKKENBERG
date: 1998-02-02 21:29:00
subject: Re: memory questions

From: pb@excelsior.xs4all.nl.REMOVE-THIS (Marc van den Dikkenberg)
Subject: Re: memory questions
 
On 2 Feb 1998 18:54:09 GMT, brianm@ims.com (Brian McLaughlin) wrote:
 
>|> If I were to dimension a dynamic string array with each variable
>|> having a maximum (but not fixed) length of 12 (I'm thinking of 8.3
>|> filenames here), how would I be able to tell, before dimensioning the
>|> array, what the maximum number of elements is that I could fit into
>|> memory? (using PowerBasic 3.5)
 
I don't know where you plan to store your data...
 
If you want to use 'normal' arrays, you can check the available amount of
memory with FRE(-1). If your arrays contain a maximum of 12 characters,
you could dimension them as ASCIIZ.
In this case, you can reserver 12 bytes of memory for each line, but if it
only contains 8 (just an example) then LEN(a(10)) will return '10', too.
You can't store dynamic length strings in memory. but, if you're sure that
12 positions will be enough, use ASCIIZ. From your point of view, they
behave exactly the same.
 
FreeBase = FRE(-1)
' This will be the maximum # of bytes you can use in conventional memory
FreeEMS = FRE(-11)
' This will be the maximum # of bytes you can use in EMS.
 
You now know how much meory you can use, and hence how large you can
dimension you array. If you want to use as much memory for your array as
possible, you simple have to devide the outcome by 12, and enter the number
in the DIMensioning lines below.
 
DIM a(      ) AS ASCIIZ*12
DIM VIRTUAL a(      ) AS ASCIIZ*12
--
Marc van den Dikkenberg
-----------------------
The PowerBasic Archives
http://www.xs4all.nl/~excel/pb.html
 
*** QwkNews (tm) v2.1
 * [TN71] Internet Newsgroup: alt.lang.powerbasic
--- GEcho 1.20/Pro
---------------
* Origin: Toast House Remote (1:100/561)

SOURCE: echomail via exec-pc

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.