Page 1 of 1

test for RESOURCE

Posted: Thu Aug 16, 2007 12:42 pm
by PaPi
Hi!

There are file: button.txt . It has one line:
First Button
And there are an example in fnxBasic help:
[code]
RESOURCE test AS ?button.txt?
DIM s AS STRING
DIM stream AS MEMORYSTREAM
Stream.loadresource(test)
Stream.position=0
s=stream.read(stream.size)
Stream.close
showmessage s `this an supplement by PaPi
[/code]

Now, there are two problems:
1. stream.cole  -> error on fnxcompiler  why?
2. if I delete this line, then fnxcompiler can make exe file. Bat, variable s NOT contain the text of the file button.txt
Why?

Thanks...
PaPi


test for RESOURCE

Posted: Thu Aug 16, 2007 3:56 pm
by Marco
HI, somehow the quotation marks does not copy correcly from the manual, so you must retype them with the "" marks.
Further more you must take care that the path is correct.
Or the resource file is in the same folder where your application file is (.bas).
Then it should work.

best regards

test for RESOURCE

Posted: Thu Aug 16, 2007 4:37 pm
by PaPi
Yes, you has right with the quotation marks.
Bat interesting, without the 2 quotation marks the filename is good too!
And, the line in the sample:

Stream.close

is wrong, there are not method close in memorystream...
Best regards
PaPi

test for RESOURCE

Posted: Fri Aug 17, 2007 9:16 pm
by Marco
Yes you`re right there is no close method for the memorystream, I think i confused it with the file object during the writing of the example.

best regards