Announcement

Collapse
No announcement yet.

MAX string length in variable?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • MAX string length in variable?

    Thank you for the sample code to break a definition into smaller
    and easier manageable parts. Now, a variaion on this.

    I have several files that are just one line, but billions of
    characters long. I.e, there is no end-of-line or carriage return
    except at the very end. If I:

    Line Input #1, getall$

    How much of that single line will I confidently obtain? Should I
    purposely read in the first million characters, work with it,
    then read in the second million, work with it and repeat until
    done?

    Thank you.

    Robert

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

  • #2
    Robert,
    I think the maximum possible string in PB/DOS is 32750 characters long.
    You'll have to limit your chunks to something less than that.

    Paul.

    Comment


    • #3
      Robert,
      With PB3.2, the documentation says the maximum size of a string is 32750 bytes.
      I recommend that you open the file as binary, and input the file as managable chunks, ie:
      Code:
      fhandle% = freefile
      open "myfile.bin" for binary as # fhandle%
      do while not eof(fhandle%)
        GET$ #fhandle%, 32750, inputString$
      ' do something with input string
      wend

      happy new year,
      Ian Cairns

      ------------------
      [email protected]
      :) IRC :)

      Comment


      • #4
        Originally posted by Ian Cairns:
        ...and input the file as managable chunks...
        That or pick up a copy of PB/CC . The console compiler should
        be able to digest that up to the available space on your hard
        drive. The syntax is quite similar but you would have to adjust
        your style to accomodiate it.


        ------------------
        There are no atheists in a fox hole or the morning of a math test.
        If my flag offends you, I'll help you pack.

        Comment


        • #5
          >That or pick up a copy of PB/CC..The console compiler should be able to digest that up to the available space on your hard drive.

          No, it can't. The maximum addressable user memory for a 32-bit application is 2.1 Gb only, not "available disk space. "

          If the file literally contains "billions" of characters, you will have to read them in chunks.

          Michael Mattias
          Tal Systems Inc. (retired)
          Racine WI USA
          [email protected]
          http://www.talsystems.com

          Comment


          • #6
            Originally posted by Michael Mattias:
            >If the file literally contains "billions" of characters, you will have to read them in chunks.
            I wrote a program to count the characters, and it has
            8,584,877,294 characters including punctuation marks and spaces.
            (thank goodness for P4s!)

            I will read them in chunks. I -had- thought about reading them in
            chunks, and write that to a temp file, and then use the temp file
            to create a properly formatted file. (This is a family history
            file, btw, and written before the advent of Windows, so it
            isn't properly formatted yet.)

            Thanks to everyone who responded!

            Robert



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

            Comment


            • #7
              it has 8,584,877,294 characters ...This is a family history file..
              I don't think I want to know that much about <U>anyone's</U> family.

              Michael Mattias
              Tal Systems Inc. (retired)
              Racine WI USA
              [email protected]
              http://www.talsystems.com

              Comment

              Working...
              X