Broken!

BlitzMax Forums/BlitzMax Beginners Area/Broken!

Caton(Posted 2016) [#1]
Code
(
Stream=ReadFile("test.txt")
TextLine$=ReadLine(Stream)
CloseFile Stream
)

When Try building app I get this error!
MaxIDE
Unhandled Exception:Attempt to access field or method of null object.
I think blitzmax is broken you please tell me a version that is not broken?


RustyKristi(Posted 2016) [#2]
No problem here as long you supplied the text file, try v1.5


Derron(Posted 2016) [#3]
It surely highlights a line containing the error.

It also shows a debugging pane (in maxide). "Stream" will be "null" there.
the problem is then the try to call "readline()" with a null param.

Short: test.txt mighr be missing. So readstream fails and you do not check weather readstream was successful or not


Bye
Ron


Floyd(Posted 2016) [#4]
The file "test.txt" either does not exist or is not in the current directory.

Print CurrentDir() at the start of the code. At least you will know where ReadFile is looking.


markcw(Posted 2016) [#5]
Since BlitzMax is obviously too complicated for you, I suggest you use something else more suitable, like a good book.


Fielder(Posted 2016) [#6]
Since BlitzMax is obviously too complicated for you, I suggest you use something else more suitable, like a good book.

:) 241 posts from this guy requesting help on "BROKEN" features of blitzmax... hahahah


coffeedotbean(Posted 2016) [#7]
you could add a null check to know if the file test.txt can be found at your specified path location.

Code
(
Stream=ReadFile("test.txt")
If Stream = Null Notifty "cannot find file to read" ; End
TextLine$=ReadLine(Stream)
CloseFile Stream
)


Dan(Posted 2016) [#8]
think blitzmax is broken you please tell me a version that is not broken?


If 1000 of your posts with the same code says that blitzmax is broken, then try blitz3d.


grable(Posted 2016) [#9]
Lol, this guy again. With the same damn "sample code" like all the other posts.
Reading from files is very very difficult for this one.
Sorry but after that many posts asking about the same thing and ignoring all the helpful comments, i think its impossible to help him.


Caton(Posted 2016) [#10]
It says Notifty not found. I think blitzmax is messed up.


Caton(Posted 2016) [#11]
I reinstall blitzmax it seems to work now thanks. I KNOW HOW TO READ A FILE IT WAS A BLITZMAX ISSUE.


Xerra(Posted 2016) [#12]
No. It was probably the way you had BlitzMax installed in the first place. Please listen to the advice people are trying to give you on how to code wisely.

AND DON'T FLIPPIN' SHOUT !!