Quickbasic String Space Problems 
Author Message
 Quickbasic String Space Problems

Can someone please help me with a problem I have with a string space
problem.

When I run a program from within Quickbasic it runs fine with no
errors. If I then compile the program as a standalone .EXE it fails
almost immediately with 'Out of string space'.

To get round the problem I reduce the size of my arrays. I've made
nearly all the records fixed length. I can't ose the
'DYNAMIC' option. Can anybody help?

-- Reg Miles



Fri, 05 Dec 1997 03:00:00 GMT  
 Quickbasic String Space Problems
: Can someone please help me with a problem I have with a string space
: problem.

: When I run a program from within Quickbasic it runs fine with no
: errors. If I then compile the program as a standalone .EXE it fails
: almost immediately with 'Out of string space'.

: To get round the problem I reduce the size of my arrays. I've made
: nearly all the records fixed length. I can't ose the
: 'DYNAMIC' option. Can anybody help?

Couldn't the problem be solved by setting the maximum stringsize? I believe
it's compiler-switch /C:nn with nn ranging over 0(?)..32K


: -- Reg Miles



Fri, 05 Dec 1997 03:00:00 GMT  
 Quickbasic String Space Problems

Quote:

>Can someone please help me with a problem I have with a string space
>problem.

>When I run a program from within Quickbasic it runs fine with no
>errors. If I then compile the program as a standalone .EXE it fails
>almost immediately with 'Out of string space'.

There are several ways to handle the problem. I limit my strings to what
is shown on the screen. If a string is longer, then I divide into smaller
strings.

GRIBBIT1$ ="XXX + XXXX + XXXXXXXXXXXXXXXXXXXXXX + XXXXXXXXXXXXXXXXXXXXXXX"
GRIBBIT2$ = "XXXXXXXXXXXXXX + XXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
GRIBBIT3$ = "XXXXXXXX + XXXXXXX + XXXXXXXXX + XXX"
GRIBBIT$ = GRIBBIT1$ + GRIBBIT2$ + GRIBBIT3$

Good luck.

Terry



Fri, 05 Dec 1997 03:00:00 GMT  
 Quickbasic String Space Problems

Quote:

>>When I run a program from within Quickbasic it runs fine with no
>>errors. If I then compile the program as a standalone .EXE it fails
>>almost immediately with 'Out of string space'.

> There are several ways to handle the problem. I limit my strings to what
> is shown on the screen. If a string is longer, then I divide into smaller
> strings.

> GRIBBIT1$ ="XXX + XXXX + XXXXXXXXXXXXXXXXXXXXXX + XXXXXXXXXXXXXXXXXXXXXXX"
> GRIBBIT2$ = "XXXXXXXXXXXXXX + XXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
> GRIBBIT3$ = "XXXXXXXX + XXXXXXX + XXXXXXXXX + XXX"
> GRIBBIT$ = GRIBBIT1$ + GRIBBIT2$ + GRIBBIT3$

> Good luck.

This does not seem like a wise way to go. Since your taking up twice the
string space. Ok say GRABBIT1$, GRABBIT2$, and GRABBIT3$ take up a total
of 300 spaces, then your taking another 300 bytes again when you load it
all up to GRIBBIT$. So your really taking up 600 instead of 300.

So I would assume using :

PRINT GRABBIT1$+GRABBIT2$+GRABBIT3$

is alot better then using :

PRINT GRABBIT$

Better yet, if the GRABBITs are of all the same charaters, then use:

GRABBIT$ = STRING(300,"X")

--

 Don Mills, Ontario.          SWLOGit - The Ultimate Shortwave Listeners
 ftp.{*filter*}ia.edu  /pub/swlogit/        Software. (Fidonet: 1:250/930)
  http://www.*-*-*.com/ (SWLOGit Web Page)



Sat, 06 Dec 1997 03:00:00 GMT  
 Quickbasic String Space Problems

(David Toste) says:

Quote:

>This does not seem like a wise way to go. Since your taking up twice the
>string space. Ok say GRABBIT1$, GRABBIT2$, and GRABBIT3$ take up a total
>of 300 spaces, then your taking another 300 bytes again when you load it
>all up to GRIBBIT$. So your really taking up 600 instead of 300.

Are you absolutely sure it works that way? I agree that using 4 shorter
lines rather than one very long line uses more bytes. However, I do not
think it doubles like you say. I think a little experimentation will show
that the penaly is about 50 to 60 bytes extra. If the one long line would
be 400 bytes, then 4 shorter lines would be about 450 bytes.I know that
my way compiles easily.I have written some very large programs using my
method. As you point out, though, your method would definitely be the
more efficient use of the bytes.

Bennie in Pflugerville, Texas  



Sun, 07 Dec 1997 03:00:00 GMT  
 Quickbasic String Space Problems


Quote:

>(David Toste) says:

>>This does not seem like a wise way to go. Since your taking up twice the
>>string space. Ok say GRABBIT1$, GRABBIT2$, and GRABBIT3$ take up a total
>>of 300 spaces, then your taking another 300 bytes again when you load it
>>all up to GRIBBIT$. So your really taking up 600 instead of 300.
>Are you absolutely sure it works that way? I agree that using 4 shorter
>lines rather than one very long line uses more bytes. However, I do not
>think it doubles like you say. I think a little experimentation will show
>that the penaly is about 50 to 60 bytes extra. If the one long line would
>be 400 bytes, then 4 shorter lines would be about 450 bytes.I know that
>my way compiles easily.I have written some very large programs using my
>method. As you point out, though, your method would definitely be the
>more efficient use of the bytes.

Somehow I don't think you understand what was said.

1 You store 300 Bytes of data into a 3 seperate strings.
2 You concentrate this data into a new string, thereby adding another
  300 Byte string to your String Data area.

  Yes, I am sure it works this way, if you would care to prove it then
  simply set the other strings to null and print the combined string.
  If it prints nothing, then I'll yield. Somehow though I think you
  were thinking of how much more code it would need, and not how
  much more data. One quick solution would be to declare the string
  with a length, this would store it in a different segment and
  probably clear up his problem.

--

    ** If only the good die young, then I'm gonna live forever >;-) **



Sun, 07 Dec 1997 03:00:00 GMT  
 Quickbasic String Space Problems

edu (Daniel P Hudson) says:

Quote:
>Somehow I don't think you understand what was said.

>1 You store 300 Bytes of data into a 3 separate strings.
>2 You concentrate this data into a new string, thereby adding another
>  300 Byte string to your String Data area.

Perhaps, as you said, I do not understand. Win or lose, I am enjoying
this discussion.

Call the following program SQUARE.BAS:

SCREEN 12
CLS
SQUARE$ = "BM200,200 C11U100R100D100L100BD100BR100C12U100R100D100L100"
DRAW SQUARE$
SLEEP (15)

Call the following program SQUARE1.BAS

SCREEN 12
CLS
SQUARE1$ = "BM200,200 C11U100R100D100L100"
SQUARE2$ = "BD100BR100C12U100R100D100L100"
SQUARE$ = SQUARE1$ + SQUARE2$
DRAW SQUARE$
SLEEP (15)

SQUARE.BAS takes up 561 bytes of disk space.
SQUARE1.BAS takes up 622 bytes of disk space.

I compiled the *.BAS files as standalone *.EXE files.

SQUARE.EXE takes up 38,856 bytes of disk space.
SQUARE1.EXE takes up 38,910 bytes of disk space.

What is it that I am not understanding?

Thanks in advance for helping me learn.

Terry in Pflugerville, Texas



Mon, 08 Dec 1997 03:00:00 GMT  
 Quickbasic String Space Problems
Well, I just ran into a problem of the 64K barrier!!!  I found out that
even after you
close a random file, the *space* for the variables in that file is still
allocated.  Of
course, you can't read the values stored there.  Anyway, after I close a
file, I set
all of the field names equal to the null string, "".  

Such as:

Open "garb" for random as #1 len=10
field #1, 5 as a$, 5 as b$
close #1
a$="":b$=""

I found also that opening the file again and again can cause me to loose
all of
my string space even if I have no other strings defined.  With setting
these
variables to null after closing, I have eraticated the error.

Hope this, in some way, helps!



Tue, 09 Dec 1997 03:00:00 GMT  
 Quickbasic String Space Problems

says...
Quote:


>: Can someone please help me with a problem I have with a string space
>: problem.

>: When I run a program from within Quickbasic it runs fine with no
>: errors. If I then compile the program as a standalone .EXE it fails
>: almost immediately with 'Out of string space'.

>: To get round the problem I reduce the size of my arrays. I've made
>: nearly all the records fixed length. I can't ose the
>: 'DYNAMIC' option. Can anybody help?

It might help if you DIM SHARED (_ALL_your variables) AS (LONG INTEGER or
DOUBLE or Whatever). This would allow the program to allow ONLY that
space that is necessary, and put each value in a space the right size.    

Tony



Tue, 09 Dec 1997 03:00:00 GMT  
 Quickbasic String Space Problems

Quote:


>(David Toste) says:

>>This does not seem like a wise way to go. Since your taking up twice the
>>string space. Ok say GRABBIT1$, GRABBIT2$, and GRABBIT3$ take up a total
>>of 300 spaces, then your taking another 300 bytes again when you load it
>>all up to GRIBBIT$. So your really taking up 600 instead of 300.

>Are you absolutely sure it works that way? I agree that using 4 shorter
>lines rather than one very long line uses more bytes. However, I do not
>think it doubles like you say. I think a little experimentation will show
>that the penaly is about 50 to 60 bytes extra. If the one long line would
>be 400 bytes, then 4 shorter lines would be about 450 bytes.I know that
>my way compiles easily.I have written some very large programs using my
>method. As you point out, though, your method would definitely be the
>more efficient use of the bytes.

>Bennie in Pflugerville, Texas  

He is saying that when the grabbit1&2&3 are copied to grabbit it will
take up the space in the grabbit1&2&3 along with the space in the grabbit
variable also.  Twice as much.

----------------------------------------------------------------------


|                                                                    |
|   - In a flame war does everybody get burnt?  :)                   |
|                                                                    |
----------------------------------------------------------------------



Tue, 09 Dec 1997 03:00:00 GMT  
 
 [ 10 post ] 

 Relevant Pages 

1. Space Space Space Space Space Space Space

2. Space Space Space Space Space Space Space

3. Space Space Space Space Space Space Space

4. disabling the space key or removing a space from a string

5. Function to Squeeze multiple spaces in a string to one space

6. Corrupted String Space Problem

7. problems with string: quotes and spaces

8. string replace with wildcard number of spaces between strings - removing blank lines

9. Strings with spaces

10. Removing spaces from a string

11. Strip Spaces from string

12. Strip spaces from string

 

 
Powered by phpBB® Forum Software