Re: Help in a Simple Program
- Posted by euphoric (admin) Nov 17, 2011
- 1274 views
Euphoric_Kid said...
When I enter Euphoria as password when program runs it shows Access Denied. But when I change password=password[1..length(password)-2], then it works fine. Why???
To return from the gets(0) function, you have to press Enter, right? That Enter character is appended to whatever you typed, so your sequence looks like
"Euphoria\n"
Using the $-1 truncates the \n and gives you the pure "Euphoria."
You could also use:
password = prompt_string( "Enter your password: " )
and not worry about it.
I think.
Oops: Didn't see you were using "$-2" and didn't know about the bug pointed out by DerekP. My solution still stands, however.