test for RESOURCE

In this category you can exchange your programming questions and solutions.
Post Reply
PaPi
Posts: 114
Joined: Wed May 16, 2007 11:55 am

test for RESOURCE

Post: # 151Post PaPi
Thu Aug 16, 2007 12:42 pm

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


Marco
Site Admin
Posts: 246
Joined: Sat Sep 15, 2018 8:41 pm

test for RESOURCE

Post: # 152Post Marco
Thu Aug 16, 2007 3:56 pm

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

PaPi
Posts: 114
Joined: Wed May 16, 2007 11:55 am

test for RESOURCE

Post: # 153Post PaPi
Thu Aug 16, 2007 4:37 pm

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

Marco
Site Admin
Posts: 246
Joined: Sat Sep 15, 2018 8:41 pm

test for RESOURCE

Post: # 154Post Marco
Fri Aug 17, 2007 9:16 pm

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

Post Reply