HELP ERROR FILE!!!
BlitzMax Forums/BlitzMax Beginners Area/HELP ERROR FILE!!!
| ||
file=ReadFile(filename$) dataline1=ReadLine(file) CloseFile(file) error says --------------- Compile Error Unable to convert from 'String to 'Int" Some Please Help!!! |
| ||
Better if you can post a complete example, instead of some code snippet. You should consider using (at least) Strict in your app. It forces you to declare variables correctly - like what variable is a String, and so on. SuperStrict Local filename:String = "somefile.txt" Local file:TStream=ReadFile(filename) Local dataline1:String=ReadLine(file) CloseFile(file) |
| ||
Seems you both repeat yourself - see this Thread file=ReadFile(filename$) titlename$=ReadLine$(file) CloseFile(file) it keeps tell me I have to define file? PLEASE HELP!!! ...won't quote Brucey's reply about "Strict" :-) bye Ron |
| ||
Seems you both repeat yourself Indeed. But since he asked so nicely this time I replied in kind :-) |
| ||
I honestly hope he hasnt been stuck on this for 6 whole days :p |
| ||
If we accept those three lines of code as the entire program and try to compile then this linedataline1=ReadLine(file)is highlighted and the error message is Unable to convert from 'String' to 'Int'. ReadLine() is a string. The error is that it cannot be converted to an Int, which is what dataline1 is by default. But Brucey's "tutorial" advice is apt. Posting code snippets and getting us to fix individual errors will never teach you programming. |