Qbasic reads my .bas wrong
Qbasic reads my .bas wrong
(OP)
In qbasic it reads:
ELSEIF comm$ = "INPUT" THEN INPUT ;
END IF
ELSEIF comm$ = "OUTPUT" THEN PRINT filesrch%(prog%, varin1$), varin2$
In Wordpad it reads:
ELSEIF comm$ = "INPUT" THEN INPUT filesrch%(prog%, varin1$), var$(searchvar%(varin2$, prog%), prog%)
ELSEIF varin2$ = "=" THEN
IF varin4$ = "+" THEN
IF STR$(VAL(varin3$)) = varin3$ AND STR$(VAL(varin5$)) = varin5$ THEN
var$(searchvar%(varin1$, prog%), prog%) = STR$(VAL(varin3$) + VAL(varin5$))
ELSE
var$(searchvar%(varin1$, prog%), prog%) = varin3$ + varin5$
END IF
ELSEIF varin4$ = "-" THEN var$(searchvar%(varin1$, prog%), prog%) = STR$(VAL(varin3$) - VAL(varin5$))
ELSEIF varin4$ = "*" THEN var$(searchvar%(varin1$, prog%), prog%) = STR$(VAL(varin3$) * VAL(varin5$))
ELSEIF varin4$ = "/" THEN var$(searchvar%(varin1$, prog%), prog%) = STR$(VAL(varin3$) / VAL(varin5$))
ELSEIF varin4$ = "/-" THEN var$(searchvar%(varin1$, prog%), prog%) = STR$(VAL(varin5$) ^ (1 / VAL(varin3$)))
ELSEIF varin4$ = "^" THEN var$(searchvar%(varin1$, prog%), prog%) = STR$(VAL(varin3$) ^ VAL(varin5$))
ELSE
var$(searchvar%(varin1$, prog%), prog%) = varin3$
END IF
ELSEIF comm$ = "OUTPUT" THEN PRINT filesrch%(prog%, varin1$), varin2$
All of the rest of that code is supposed to be there, and the program won't work without it. It also gives me a variable required error because of it. Why does it do this and how do I fix it?
ELSEIF comm$ = "INPUT" THEN INPUT ;
END IF
ELSEIF comm$ = "OUTPUT" THEN PRINT filesrch%(prog%, varin1$), varin2$
In Wordpad it reads:
ELSEIF comm$ = "INPUT" THEN INPUT filesrch%(prog%, varin1$), var$(searchvar%(varin2$, prog%), prog%)
ELSEIF varin2$ = "=" THEN
IF varin4$ = "+" THEN
IF STR$(VAL(varin3$)) = varin3$ AND STR$(VAL(varin5$)) = varin5$ THEN
var$(searchvar%(varin1$, prog%), prog%) = STR$(VAL(varin3$) + VAL(varin5$))
ELSE
var$(searchvar%(varin1$, prog%), prog%) = varin3$ + varin5$
END IF
ELSEIF varin4$ = "-" THEN var$(searchvar%(varin1$, prog%), prog%) = STR$(VAL(varin3$) - VAL(varin5$))
ELSEIF varin4$ = "*" THEN var$(searchvar%(varin1$, prog%), prog%) = STR$(VAL(varin3$) * VAL(varin5$))
ELSEIF varin4$ = "/" THEN var$(searchvar%(varin1$, prog%), prog%) = STR$(VAL(varin3$) / VAL(varin5$))
ELSEIF varin4$ = "/-" THEN var$(searchvar%(varin1$, prog%), prog%) = STR$(VAL(varin5$) ^ (1 / VAL(varin3$)))
ELSEIF varin4$ = "^" THEN var$(searchvar%(varin1$, prog%), prog%) = STR$(VAL(varin3$) ^ VAL(varin5$))
ELSE
var$(searchvar%(varin1$, prog%), prog%) = varin3$
END IF
ELSEIF comm$ = "OUTPUT" THEN PRINT filesrch%(prog%, varin1$), varin2$
All of the rest of that code is supposed to be there, and the program won't work without it. It also gives me a variable required error because of it. Why does it do this and how do I fix it?
RE: Qbasic reads my .bas wrong
i dont know if this will be helpfull but i hope it will help a little.
RE: Qbasic reads my .bas wrong
i'll post your question at qbasicnews, and see if the folks there can answer it. don't worry, help is on the way!
RE: Qbasic reads my .bas wrong
RE: Qbasic reads my .bas wrong
Futhermore I noticed that it does indeed load it corretly, it changes it when I hit the F5 key. ???
RE: Qbasic reads my .bas wrong
If that's the case, perhaps something else is going wrong?
RE: Qbasic reads my .bas wrong
Wandering Guru
Joined: 16 May 2002
Posts: 300
Location: Winnipeg, Manitoba
Posted: Fri Mar 05, 2004 6:06 am Post subject:
--------------------------------------------------------------------------------
How big is your bas file. Maybe it's too big for the IDE.
_________________
-This statement is false.
-Ignore this advice.
T.A.N.K : www.geocities.com/juice801980/tank.zip
(right click, save-as...)
Back to top
Antoni Gual
Mayor Afiliación
Joined: 08 Dec 2002
Posts: 591
Location: Barcelona, Spain
Posted: Fri Mar 05, 2004 12:46 pm Post subject:
--------------------------------------------------------------------------------
If you copied it from Inet it probably has the end of line format of unix and QB can't read it. Some browsers convert it automatically, some not.
Try to open it with W9x DOS Edit (it should display ok there) then save it. The saved file should work with qb
_________________
Antoni
RE: Qbasic reads my .bas wrong
RE: Qbasic reads my .bas wrong
As SJZero said (and I have done this on several occasions) you can copy from a Window's Textbox, such as wordpad, and directly paste it to QB or Qbasic.
--MiggyD
RE: Qbasic reads my .bas wrong
yeah, well it probably has something to do with the way notepad saves files.
RE: Qbasic reads my .bas wrong
Are you sure you have not introduced any char >128? The forum would probably filter it. Maybe you could copy and paste the missing part from your own post :D
If you don't have an hex editor you could check it with DOS Edit, it has an option to display a file as binary. Look for any non printable caracter different from the CR+LF pairs.
Antoni
http://www.geocities.com/antonigual/index.html
RE: Qbasic reads my .bas wrong
I am sure that there is no weird characters, what you see in the forum is a perfect duplicate of my original code. Notepad saves files as simple text files, which is the same way that I normally save code in qbasic.
RE: Qbasic reads my .bas wrong
Do you have a memory chip tester? or how about too low on memory?
--MiggyD
RE: Qbasic reads my .bas wrong
could you post the file?
Also interesting if it happens in other Basic versions.
It could be some glitch in Basic.
My students several time make Basic say "Out of memory for strings" or something like that - and then program became corrupted. And it was rather small (screen-size or two) program.