March 28, 2024, 06:03:28 PM

News:

Own IWBasic 2.x ? -----> Get your free upgrade to 3.x now.........


large strings

Started by GJ, February 11, 2007, 08:22:15 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

GJ

Hi,


Just some fooling around with big strings / reading big datablocks , i encountered that i can't go further than this stepsize (53215)
I have no problem with that, i can always use smaller amount of stepsize ;D

Regards,

Gertjan (GJ)



Quote
autodefine "off"

BFILE myfile
string filename$,a
memory memoryfile
istring l$[3000000]
int flen,count
int linelen

filename$="C:\\abc.txt"

/*
a="ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890"

IF OPENFILE(myfile, filename$, "W") = 0
   for count=1 to 20000
   WRITE myfile, a+USING("####",count)
   next count
   CLOSEFILE myfile
ENDIF
*/

IF OPENFILE(myfile,filename$, "r") = 0
  flen = LEN(myfile) 
closefile myfile
ENDIF

allocmem memoryfile,1,flen+1

'write to memory

IF OPENFILE(myfile,filename$,"r") =0
  __read(myfile,L$,flen)
__writemem memoryfile,1,l$,flen
ENDIF

'read from memory back

__readmem memoryfile,1,l$,flen

linelen=53215  : 'still works
' linelen=53216 : 'doesnt work

for count=1 to flen step linelen
print mid$(l$,count,linelen)
print count
next count

print
print " Any key to end"
do:until inkey$<>""
freemem memoryfile
end





Ionic Wind Support Team

Your exceeding the capabilities of the PRINT statement.  PRINT has an internal 32K buffer that it copies the converted paramters to before outputting them to the console or window.  I never thought anyone would be exceeding that buffer ;)

I will change it in the next update to properly truncate without overwriting the buffer.

Paul.
Ionic Wind Support Team

Parker

So that's what it is. I remember a program crashing when I printed a whole big string at once, but doing fine if I printed it in individual pieces. I think it was a tokenizer program.

Rod

QuoteI never thought anyone would be exceeding that buffer

Buffer size limits exist to be exceeded.

Set the limit to 1 Gb, and somebody somewhere will try to print 2 Gb!!!

GJ

Thanks Paul for the explanation, btw i don't need 1 Gb , i was just curious why it didnt work  ;)


Regards,


GJ