I'm having a problem getting a test program to work and for the life of me I can't see why.
pointer ptr
istring a$[100000],b$[100000]
OPENCONSOLE
' load a$ with < 100,000 characters
a$=string$(99990,"@")+"999"
' set aside memory to hold it
ptr = NEW(Char,len(a$)+1)
' load memory with contents of a$
#<string>ptr=a$
' prove contents of a$ is in memory pointed to by ptr
a$=""
pRINT "This is 1st character ",#<string>ptr[0]
pRINT "This is last character ",#<string>ptr[99999]
' but this causes a crash here
'print #<string>ptr
' what I now want to do is load the contents of the memory pointed to
' by ptr into the varable b$.
b$ = #<string>ptr
' the length of b$ indicates the transfer was made
print len(b$)
' although caused a crash above it works here
print #<string>ptr
' this line won't print
print "[",b$,"]"
a$=b$
' and this line won't print
print "[",a$,"]"
a$=""
' but this will print
print "[",a$,"]"
DELETE ptr
PRINT "PRESS <ANY> KEY TO END!"
DO:UNTIL INKEY$<>""
END
I know the answer is simple and obvious but I've played with it every different way I can think of and I can't make it work.
Edit: If I keep the size of the the string (a$) to less than 53216 it appears to work okay; even if I set aside 100,000 chars with the new command.
HELLLLLLPPPPPPPP!!!! ??? ???
Larry,
Take a look at "large strings (http://www.ionicwind.com/forums/index.php/topic,1472.msg13753.html#msg13753)."
Bob,
Thanks a million$!
I've been beating my head against the wall all day over that.
Larry
Quote from: Larry McCaughn on June 25, 2007, 06:17:14 PM
Thanks a million$!
Your invoice is in the mail!
:D
P.S. Just kidding.
;D
The real kicker is that I was printing only for debugging purposes. The contents actually goes to a file, which works fine.
It does kill one little feature of the program I'm working on.
In my filesave function I had it so it would go to the screen if you passed it file name of "2screen"; otherwise it would go to a file.
Can't use that now if a have a variable value greater than that 50,000+
And it's probably not something Paul will fix anytime soon with his current focus on Linux, the courses, and his new job.
And as I "ALWAYS" tell my creditors.....
"Checks in the mail!"