ERROR!
BlitzMax Forums/BlitzMax Beginners Area/ERROR!
| ||
file=WriteFile("test.cfg") WriteLine(TextFieldText$(TestBox),file) CloseFile(file) Error says unable to convert String to TStream Guys Please Help! |
| ||
Hmmmm... I've seen this question a couple of times now from you. Maybe you should read the other answers? - Always put "Superstrict" above your code. - WriteFile is a function that returns a TStream object. - WriteLine needs parameters (stream:TStream,str$) |
| ||
Maybe you should read the other answers? Good suggestion :-) |
| ||
file:TStream=WriteFile("test.cfg") WriteLine(TextFieldText$(UsernameBox),file) CloseFile(file) didn't WORK! |
| ||
Someone should report you for senseless spamming. You asked the exact same question multiple times, you do not respond to the responses given there. bye Ron |
| ||
Maybe he doesn't understand English? Caton, what's your native language? :-) |
| ||
Maybe its a non human intelligence and it is we who are misunderstanding the question. Or... maybe its a secret "spy" message, and the correct answer will be something innocuous but the nest day the eiffel tower gets bombed. |
| ||
Caton, please post the ENTIRE program you are working on. Maybe then we'll understand what the real question is here you are asking. |
| ||
I don't use Max but I am guessing looking at your briefest of code snippets that you simply have the parameters around the wrong way? http://www.blitzbasic.com/bmdocs/command.php?name=writeline&ref=goto Stream comes first, not the string.... The other guy at the first response already told you this..... |
| ||
After so many posts with the same code snippet with only minor tweaks each time. And the fact that he doesnt answer except with the same snippet again, leads me to believe he is trolling. |
| ||
Thanks Matty for helping me with that error. |
| ||
Hey not function doesn't work see code. Global Username$,Password$ Function LoadLogin(filename$) file=ReadFile(filename$) Username$=ReadLine$(file) Password$=ReadLine$(file) CloseFile(file) End Function LoadLogin("login.txt") If Not Username$="admin" Then End If Not Password$="password" Then End txt file================= admin1 password1 ================= if won't do anything if username and password are incorrent! |
| ||
if won't do anything if username and password are incorrent! Well... If Not Username$="admin" Then Endtells the program to shut down, because "admin" does not equal "admin1". If you want a program to "do something" you'll need to program it, like If Not Username$="admin" Then notify "Incorrect username"; End |
| ||
If Not Username$="admin" Then Notify "Incorrect username"; End Still didn't work could this be a bug in blitzmax? |
| ||
If Not Username$="admin" Then Notify "Incorrect username"; End Still didn't work could this be a bug in blitzmax? No, it's just a bad example. This works: username$="a" If Not (Username$="admin") Then Notify "Incorrect username"; End And so does this: username$="a" If Username$<>"admin" Then Notify "Incorrect username"; End |
| ||
This works: username$="a" If Not (Username$="admin") Then Notify "Incorrect username"; End What's the point of setting a string manually and then running another manual check on it the next line? The way I read post #12, a user has saved his login to a file named login.txt. The program will then set variable username$ to "admin1" according to these file contents: txt file================= admin1 password1 ================= And "admin1" does not equal "admin". So I assume what happens next is "the program doesn't work", which it shouldn't. But many of the posts by Caton are a little cryptic as to what "does not work" really means :) |
| ||
What's the point of setting a string manually and then running another manual check on it the next line? I read it as a sample to show how it works, runable by its own.Which is a better fit really, when we dont know the real contents of his files. |
| ||
when we dont know the real contents of his files. True. Caton, run your program in debug mode and use commands: Debuglog "Username: " + username$ Debuglog "Password: " + password$ etc... when things don't work as expected. |