Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Author
Message
SoulMan
23
Years of Service
User Offline
Joined: 22nd Nov 2002
Location: In a house somewhere on the planet earth
Posted: 5th Nov 2003 05:58
Hey
I am trying to read in a text file and I want to use a string that will stop the reading of the file. Well, everytime I run this, it says the variable while doesn't exsist at such and such line
Here is my code

Open To Read 1, "c:\test.txt"
While (test$ <> "<END>")
Read String 1, test$
Print test$
End while
wait 60000
Close File 1
End

I don't get what is going on. This should work. In fact, I might just break out Qbasic to see if it works. However, please let me know what I am doing wrong. Also, can anyone make up a list of all the Equality Tests we have. I certainly cannot find them in the command reference in the command help in Dark Basic Pro.
Thanks.
SoulMan

I am my own and own my am I
CattleRustler
Retired Moderator
22
Years of Service
User Offline
Joined: 8th Aug 2003
Location: case modding at overclock.net
Posted: 5th Nov 2003 06:09
its ENDWHILE not END WHILE

-RUST-
SoulMan
23
Years of Service
User Offline
Joined: 22nd Nov 2002
Location: In a house somewhere on the planet earth
Posted: 6th Nov 2003 02:39
Excuse me, you don't have to be rude about it.
Now that I have tested the code with the correct ENDWHILE statement, all I get is a blank screen. Can someone tell me if I am using the correct equality statement <>.
Isn't that NOT EQUAL TO?
Or is it something else?
Thanks. If the command reference was better I wouldn't be asking these questions.
SoulMan

I am my own and own my am I
empty
23
Years of Service
User Offline
Joined: 26th Aug 2002
Location: 3 boats down from the candy
Posted: 6th Nov 2003 02:56 Edited at: 6th Nov 2003 02:57
I don't think he was rude, just trying to point out the difference (between "endwhile" and "end while")

As for your code, insert the line
test$ = "" before the while statement:

test$ = ""
Open To Read 1, "c:test.txt"
While (test$ <> "<END>")
Read String 1, test$
Print test$
Endwhile
wait key
Close File 1
End

Don't know why, and it shouldn't be nessecary.

Me, I'll sit and write this love song as I all too seldom do
build a little fire this midnight. It's good to be back home with you.
CattleRustler
Retired Moderator
22
Years of Service
User Offline
Joined: 8th Aug 2003
Location: case modding at overclock.net
Posted: 6th Nov 2003 03:22
(Thanks Empty)

@ SoulMan
I wasn't trying to be rude! I was trying to help!
You could have chosen to interpret my message any number of ways, you chose "rude", I say "to the point"

whatever

-RUST-
SoulMan
23
Years of Service
User Offline
Joined: 22nd Nov 2002
Location: In a house somewhere on the planet earth
Posted: 6th Nov 2003 08:41
Rude as in being to the point.
I have a dislike for people TO THE POINT.
Why? Because it seems like I was asking the wrong question.
Anyway.
I figured out why. The variable is pointing to something else.
That is why it's a good idea to declare and set a variable to a value. I also figured out that it would print <END> so I included a if statement to prevent it from printing <END>.
Pretty neat.
SoulMan

I am my own and own my am I
CattleRustler
Retired Moderator
22
Years of Service
User Offline
Joined: 8th Aug 2003
Location: case modding at overclock.net
Posted: 6th Nov 2003 16:16
again, whatever.

-RUST-
SoulMan
23
Years of Service
User Offline
Joined: 22nd Nov 2002
Location: In a house somewhere on the planet earth
Posted: 7th Nov 2003 04:59
See that's what I am talking about.
SoulMan

I am my own and own my am I
Xander
23
Years of Service
User Offline
Joined: 3rd Mar 2003
Location: In college...yeah!
Posted: 7th Nov 2003 06:08
Don't start a flame war please...

The information in this thread was useful. I will try to remember that for future reference. I hope I am not being rude.

Xander - Bolt Software

Why do the antagonists always have to look so cool?
CattleRustler
Retired Moderator
22
Years of Service
User Offline
Joined: 8th Aug 2003
Location: case modding at overclock.net
Posted: 7th Nov 2003 06:21
I'll digress on this one

Good luck with everything SoulMan - seriously
I wish you all the best

-RUST-
SoulMan
23
Years of Service
User Offline
Joined: 22nd Nov 2002
Location: In a house somewhere on the planet earth
Posted: 7th Nov 2003 08:25
Thank you CattleRustler, I wish you well on your game making journey as well.

Bolt, I am not sure how much you can get from this. One thing is that this isn't the best way for reading in text files. Or it might be. What I will do is come up with two ways to read in text files. One for Strings and one for Bytes. This will make reading text files easier. This will contain logic or info on how the logic is suppose to work. Reading files and writing them is not an easy task.
If I get time tommorow or this weekend I will whip it up.
I am getting closer to how I am creating my project. I will keep all up to speed.
Have a good evening, day or afternoon where you are in the world.
SoulMan

I am my own and own my am I
Jess T
Retired Moderator
22
Years of Service
User Offline
Joined: 20th Sep 2003
Location: Over There... Kablam!
Posted: 7th Nov 2003 09:27 Edited at: 8th Nov 2003 03:02
fine then.. if noone wants my help ill pack my things and leave...


Team EOD :: Programmer/Logical Engineer/All-Round Nice Guy
Inkybro
23
Years of Service
User Offline
Joined: 31st Dec 2002
Location: Where I live :)
Posted: 7th Nov 2003 22:39
Uhh... CattleRustler is extremely helpful and kind. The only person with an attitude problem around here is you, SoulMan. When people help you, rude or not, you should be thankful.


http://fingaming.0wns.org/nANo/
VexenPONG: 85% Complete -- Wizard Duels - The Arena: 20% Complete -- ZAP: 2% Complete
Inkybro
23
Years of Service
User Offline
Joined: 31st Dec 2002
Location: Where I live :)
Posted: 7th Nov 2003 23:00
Listen, I was not trying to be an arse either but I just wanted to voice my opinion


http://fingaming.0wns.org/nANo/
VexenPONG: 85% Complete -- Wizard Duels - The Arena: 20% Complete -- ZAP: 2% Complete
CattleRustler
Retired Moderator
22
Years of Service
User Offline
Joined: 8th Aug 2003
Location: case modding at overclock.net
Posted: 8th Nov 2003 02:01
@InkyBro

thanks to coming to my defense.
SoulMan insisted on something, based on his own interpretations of a plain text message - which is fine. I will continue to try and be helpful to people here but I do maintain a list of people who "just don't get it".

-RUST-
IanM
Retired Moderator
23
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 8th Nov 2003 02:55
I really don't understand what the initial fuss was about, but hopefully this will now be the end of it.
CattleRustler
Retired Moderator
22
Years of Service
User Offline
Joined: 8th Aug 2003
Location: case modding at overclock.net
Posted: 8th Nov 2003 03:49 Edited at: 8th Nov 2003 03:53
as always, Ian not understanding the initial fuss. Try reading the above posts - I am sorry but it seems as though I am damned if I do-damned if I don't, all I said originally was

it's ENDWHILE not END WHILE

and yes, its been over

-RUST-
CattleRustler
Retired Moderator
22
Years of Service
User Offline
Joined: 8th Aug 2003
Location: case modding at overclock.net
Posted: 8th Nov 2003 03:55
if the thread above doesn't stand on it's own in explaining what I mean then I will leave these forums - post haste!

I expect an answer from IanM

-RUST-
SoulMan
23
Years of Service
User Offline
Joined: 22nd Nov 2002
Location: In a house somewhere on the planet earth
Posted: 8th Nov 2003 08:30
Wow, didn't mean for this to go as far as it has.
Hey, we just need to all sit down and have a nice frosty beer!
SoulMan

I am my own and own my am I
IanM
Retired Moderator
23
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 8th Nov 2003 22:58 Edited at: 8th Nov 2003 23:00
@CattleRustler ...

My comment wasn't directed at you. I suppose it would have been more accurate for me to say 'I don't really understand why there was an initial fuss'. If I'm in a rush, I sometimes post 'to the point' type comments myself.

I certainly appreciate the amount of effort you put in to helping people on these forums, as I expect almost everyone else does too, especially those on the newcomers forum.

@SoulMan, give people a break - not everyone has a lot of time free, and those that give it freely despite not having a lot of it should be appreciated.
CattleRustler
Retired Moderator
22
Years of Service
User Offline
Joined: 8th Aug 2003
Location: case modding at overclock.net
Posted: 8th Nov 2003 23:17
Thank You Ian, I appreciated your comments. And thank you also for all of your help along the way! I am sorry if I sounded snotty to you I was just a little peeved is all. I apologize to Ian and SoulMan.

Group hug
Now for that Frosty beer...


-RUST-
Jess T
Retired Moderator
22
Years of Service
User Offline
Joined: 20th Sep 2003
Location: Over There... Kablam!
Posted: 9th Nov 2003 08:41
Lol... Group Hug... lol...


Team EOD :: Programmer/Logical Engineer/All-Round Nice Guy
SoulMan
23
Years of Service
User Offline
Joined: 22nd Nov 2002
Location: In a house somewhere on the planet earth
Posted: 10th Nov 2003 07:16
Heh heh
SoulMan

I am my own and own my am I

Login to post a reply

Server time is: 2026-07-26 15:30:22
Your offset time is: 2026-07-26 15:30:22