home *** CD-ROM | disk | FTP | other *** search
/ The World of Computer Software / World_Of_Computer_Software-02-386-Vol-2of3.iso / c / copyfx11.zip / COMPILE_.NO! next >
Text File  |  1990-12-21  |  4KB  |  83 lines

  1.    *** WARNING *** belonging to the programs CODEBOOK.BAS and COPYFIX.BAS
  2. =============================================================================
  3.  
  4. Do not attempt to compile this BASICA/GWBASIC program for the moment.
  5. There may occur problems with the algorithm if compiled with e.g. QBASIC 4.5.
  6. These deal with the maximum size of a character element (incl. after LINE INPUT)
  7. which may be different from the 255 characters in interpreted BASIC.
  8. The claimed number of 32767 in QBASIC could not (yet) be used successfully.
  9. Before compiling successfully the next problem has to be solved firstly:
  10. -----------------------------------------------------------------------------
  11.  
  12. This is a QB (vs. 4.5) test program demonstrating astonishing pecularities
  13. contradictory to claims in the manual. See the comments................
  14. Test both with and without the "/AH" command line parameter of QB/BC.
  15.  
  16. ----------------------------------TEST.BAS-----------------------------------
  17. OPTION BASE 1
  18. REM $DYNAMIC
  19. COMMON record$() 'necessary?
  20. DIM record$(1) 'in order to have the REM $DYNAMIC statement work (?)
  21. record$(1) = SPACE$(32000)
  22. 'record$(1) = "" 'if you comment this "OUT OF STRING SPACE" occurs below
  23. record$(1) = SPACE$(32000)
  24. PRINT LEN(record$(1))
  25. ' the line below yields "OUT OF STRING SPACE" ; comment it for further test
  26. IF record$(1) = SPACE$(32000) THEN PRINT "equal" ELSE PRINT "unequal"
  27. INPUT "filename:"; filename$ 'name a file with lines with lengths of >24kb
  28. OPEN "i", #1, filename$      'that file may have been created with:
  29. WHILE NOT EOF(1)        'OPEN "o", #2, "long": PRINT #2, SPACE$(32767): CLOSE 2
  30.  LINE INPUT #1, record$(1) ' always causes "OUT OF STRING SPACE" with lines
  31.                            ' larger than about 24k bytes, while 32767 bytes
  32.                            ' should be allowed to be read in one line
  33.  PRINT LEN(record$(1))
  34. WEND
  35. CLOSE 1
  36. END
  37. -----------------------------end of TEST.BAS-----------------------------
  38.  
  39. Working with large strings (32767 long) in this way is essential for me.
  40. Apparently I cannot get it to work allright. As the claims of QB may be
  41. regarded true, I presumably am doing something very wrong. What do I do
  42. wrong? Who can help me?
  43.  
  44. My intention is to read and manipulate very (infinitely) long lines
  45. sequentially.
  46. In GWBASIC this can be accomplished very easy using LINE INPUT:
  47. a. if the string read by LINE INPUT is 0 to 254 characters long
  48.    a whole (or last part, see below) input line has been read;
  49.    the CRLF are NOT part of the string, but EOL has been found.
  50. b. if the string read by LINE INPUT is 255 long (GWBASIC's maximum)
  51.    a partial line has been read (to be printed with ";" at the end
  52.    to suppress the CRLF output) and a succeeding LINE INPUT will
  53.    read the next part of the line (up to 255), as in a) or b).
  54. In this way I am able to read and process very, very, very long lines,
  55. only limited by the amount of disk space.
  56.  
  57. In QuickBasic the maximum length for strings (string elements) is 32767
  58. instead of 255. Assuming the same algorithm would be valid substituting
  59. 32767 for 255 the same intention would be possible in QB, but the above
  60. described problems hinder the application of the algorithm.
  61.  
  62. The solution to the problem would be:
  63. a. a right solution to prevent the error reports above or
  64. b. a limitation change for the maximum string length in QB
  65.    from 32767 to a much lower value, e.g. 255.
  66.  
  67. I tried to circumvent the problem writing an alternate LINE INPUT routine
  68. using char$=INPUT$(1,#1) and so on, interpreting the character, checking
  69. for CR or LF, adding another character to a string, but that finally
  70. also aborted because in the adding expression the initial as well as
  71. the resulting strings became too long. Besides, such a solution works
  72. very, very slowly, compared to LINE INPUT.
  73.  
  74. So again, who can help me or give me any hints?
  75.  
  76. Regards - Jim Groeneveld.
  77. Centrum voor Medische Informatica TNO       <Email>              |  |  |\/|
  78. TNO Center for Medical Informatics | GROENEVELD@CMI.TNO.NL  |  \_/  |  |  |
  79. ( CMI-TNO )    | Y. Groeneveld     | GROENEVELD@CMIHP1.UUCP | Jim Groeneveld
  80. P.O.Box 124    | Wassenaarseweg 56 | GROENEVELD@TNO.NL      | Schoolweg 14
  81. 2300 AC Leiden | 2333 AL Leiden    | ...@HDETNO51.BITNET    | 8071 BC Nunspeet
  82. Nederland.     | (+31|0)71-181810  | Fax (+31|0)71-176382   | 03412-60413
  83.