Results 1 to 7 of 7

Thread: String simple problem

  1. #1

    Thread Starter
    Registered User Lior's Avatar
    Join Date
    Jan 2000
    Posts
    307

    Post

    Hey...

    When I saw the help for the String Data Type, I saw it can contain up to approximately 2 billion characters.
    In fact, it should contain up to 2^31 characters, and this is exactly 2,147,483,648
    But when I try to put in the string only 2 million characters, I get an error: "Out Of String Space"
    Why?!
    I use this simple code:
    Code:
    Dim X,A as String
    A=Space(10000000)
    X=A+A
    In the 3rd line I get the Error.
    Why?!
    Any Ideas?

  2. #2
    Hyperactive Member
    Join Date
    Jan 1999
    Location
    Rotterdam, Netherlands
    Posts
    386
    Has probably to do with your computer, on my NT Server with 128Mb RAM, I could run your code (although the machine became *very* slow, I didn't get an error....)
    Hope this helps

    Crazy D

  3. #3
    Fanatic Member
    Join Date
    Apr 2000
    Location
    Whats a location?
    Posts
    516
    I tried it, too, on my computer (433 mHZ, 196MB of RAM) and it worked fine.
    Courgettes.

  4. #4
    Fanatic Member
    Join Date
    Mar 2000
    Location
    That posh bit of England known as Buckinghamshire
    Posts
    658
    your problem lies with your maths.

    Dim X,A as String
    A=Space(10000000)
    X=A+A

    A+A will in fact = 20,000,000 (20 million) not 2,000,000 (2 million)
    Iain, thats with an i by the way!

  5. #5

    Thread Starter
    Registered User Lior's Avatar
    Join Date
    Jan 2000
    Posts
    307
    Guys,
    I run this code on my Celeron 500, 64MB RAM.
    And btw, I know it should be 20 million and not 2 million,
    but string can contain up to 2 Billion!!! (2000 million!)
    why the string cant handle only 20 million?!?!
    Did Microsoft's VB Team Lie ?!

    Any Ideas?

  6. #6
    transcendental analytic kedaman's Avatar
    Join Date
    Mar 2000
    Location
    0x002F2EA8
    Posts
    7,221

    Thumbs down

    You need 2G of RAM, then or wait that terrible time while windows is swapping these 2G to your harddisk, i have on a mistake made a 400M string and it took me 15 min to wait.
    Use
    writing software in C++ is like driving rivets into steel beam with a toothpick.
    writing haskell makes your life easier:
    reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
    To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.

  7. #7
    Addicted Member
    Join Date
    Jul 1999
    Location
    Bergen, Norway
    Posts
    143

    Lightbulb

    your problem is in your hardware..
    you should atleast have 128 mb. ram for this action.
    I got 112 mb. and it didn't work wery well.
    but when I tried it at my other comp with 128 mb. it worked.


    -Lumin

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width