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