Re: Who are my parents?

 BBS: Inland Empire Archive
Date: 09-12-92 (12:59)             Number: 264
From: TONY ELLIOTT                 Refer#: NONE
  To: FRANCOIS ROY                  Recvd: NO  
Subj: Re: Who are my parents?        Conf: (2) Quik_Bas
Francios,

FR> Good idea except the calling pgm may not be one I write
FR> (it may actually be
  > a commercial pgm especially modified to interface with our stuff), and,
  > more importantly (and I wish I could figure this one out!!): no matter how
  > much environment space I give myself and no matter how hard I try, I keep
  > getting the infamous 'Out of memory' error every time I
  > try to assign a new
  > string to the environment.

When you program loads, a COPY of the master environment is loaded
with your program. Only the active variables are copied; not the empty
space. In other words, the copy of the table accessable from BASIC is
full before you even start.

The way around this is to allocate a dummy variable before your
program loads. Use it to allocate as much space as you'll need to
manipulate from within your program:

        From DOS:  Set Dummy=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

When your program starts, do this:

        ENVIRON("Dummy") = ""

You can now add your own variables to the copy of the environment
loaded with your program.

        ENVIRON("MyVar") = "Hey, it works!"

Remember, changes you make from your app will only be in effect while
your app is running. If you SHELL, child processes will get a copy of
your copy, but as soon as you terminate the program, the original
environment is restored.

Hope this helps!

Tony
___
 X 1st 1.01b #1030s X A clean desk is a sign of a -sick- mind

--- Maximus 2.01wb
 * Origin: Oakland BBS (1:133/706)
Outer Court
Echo Basic Postings

Books at Amazon:

Back to BASIC: The History, Corruption, and Future of the Language

Hackers: Heroes of the Computer Revolution (including Tiny BASIC)

Go to: The Story of the Math Majors, Bridge Players, Engineers, Chess Wizards, Scientists and Iconoclasts who were the Hero Programmers of the Software Revolution

The Advent of the Algorithm: The Idea that Rules the World

Moths in the Machine: The Power and Perils of Programming

Mastering Visual Basic .NET