×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Contact US

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Qbasic reads my .bas wrong

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?

RE: Qbasic reads my .bas wrong

i find that if i write anything outside of qbasic that wordpad works the best because it has never ending lines and can save as the following format (any file ".")

i dont know if this will be helpfull but i hope it will help a little.

RE: Qbasic reads my .bas wrong

lol!

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

using wordpad, cut that extra text right out of the program using (appropriately enough) the cut command. Then save the file. Now open the file in QB, and make it into a window. point your text cursor to where the code started before, right click on the top of the window, go to edit, and hit paste. (if you're using 9x/ME, there's a paste button at the top already). This will sort of 'type' the code out in the editor, so you can see where it all is. Then just correct your alignment, and you shouldn't have any more problems.

RE: Qbasic reads my .bas wrong

(OP)
You can't paste something into qbasic from windows, you can only paste from qbasic to itself.

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

You most certainly can, I just told you how. :P

If that's the case, perhaps something else is going wrong?

RE: Qbasic reads my .bas wrong

R@dioman
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

(OP)
No, I wrote it myself in Wordpad, and it is less than 20K

RE: Qbasic reads my .bas wrong

qbasicking:

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

well, you learn something new every day. :D

yeah, well it probably has something to do with the way notepad saves files.  

RE: Qbasic reads my .bas wrong

If I copy your code from the forum, paste it to W2000 wordpad, save it with .bas extension and open it with QBN45, everything shows ok.
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

(OP)
It shows the code corretly, it just changes it after pressing F5, then it gives me an error.

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

Almost sounds like a memory issue, especially in the lower 640K zone.

Do you have a memory chip tester? or how about too low on memory?

--MiggyD

RE: Qbasic reads my .bas wrong

qbasicking,
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.

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close