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.

DarkBASIC Discussion / File Load help..

Author
Message
Dark Dragon
16
Years of Service
User Offline
Joined: 22nd Jun 2007
Location: In the ring, Kickin\' *donkeybutt*.
Posted: 18th Feb 2010 00:32


Sorry for cutting straight to the point, but if I'm reading from a file that contains :



how would I go about reading all the 1's and 0's on the same line?

I know this is a kindda noobish question......

(\__/) HHAHAHAHAHAH!
(O.o ) / WORLD DOMINATION!!!!!!!!!!
(> < )
TheComet
16
Years of Service
User Offline
Joined: 18th Oct 2007
Location: I`m under ur bridge eating ur goatz.
Posted: 18th Feb 2010 00:42
Is this stored as a string?


Make the paths of your enemies easier with WaypointPro!
Dark Dragon
16
Years of Service
User Offline
Joined: 22nd Jun 2007
Location: In the ring, Kickin\' *donkeybutt*.
Posted: 18th Feb 2010 00:43
Do you mean when i'm loading in or saving out....?

(\__/) HHAHAHAHAHAH!
(O.o ) / WORLD DOMINATION!!!!!!!!!!
(> < )
TheComet
16
Years of Service
User Offline
Joined: 18th Oct 2007
Location: I`m under ur bridge eating ur goatz.
Posted: 18th Feb 2010 00:56
Both.

Did you save it like:

write string 1,"11111110"

or

write byte 1,254

?

TheComet


Make the paths of your enemies easier with WaypointPro!
Dark Dragon
16
Years of Service
User Offline
Joined: 22nd Jun 2007
Location: In the ring, Kickin\' *donkeybutt*.
Posted: 18th Feb 2010 00:58
I wrote the file myself in Note pad, which is the same as the first one i beleave.......

(\__/) HHAHAHAHAHAH!
(O.o ) / WORLD DOMINATION!!!!!!!!!!
(> < )
TheComet
16
Years of Service
User Offline
Joined: 18th Oct 2007
Location: I`m under ur bridge eating ur goatz.
Posted: 18th Feb 2010 01:02
Ah ok.

I believe middle$() is the command you are looking for.



TheComet


Make the paths of your enemies easier with WaypointPro!
Dark Dragon
16
Years of Service
User Offline
Joined: 22nd Jun 2007
Location: In the ring, Kickin\' *donkeybutt*.
Posted: 18th Feb 2010 01:09
I cant seem to compile the code...... But basically, youre saying to load it in as a string and Cut it up into to the seperate parts right? that makes sense......Thanks Dude! you have my graditude...

(\__/) HHAHAHAHAHAH!
(O.o ) / WORLD DOMINATION!!!!!!!!!!
(> < )
TDK
Retired Moderator
21
Years of Service
User Offline
Joined: 19th Nov 2002
Location: UK
Posted: 18th Feb 2010 01:26
Quote: "middle$(s$,t,t+1)"


Mid$(s$,t)

TDK

TheComet
16
Years of Service
User Offline
Joined: 18th Oct 2007
Location: I`m under ur bridge eating ur goatz.
Posted: 18th Feb 2010 01:27
Ah yes, I knew it was something like that! I thought mid$() expects 3 things:

mid$(<string>,start pos,end pos)

TheComet


Make the paths of your enemies easier with WaypointPro!
TDK
Retired Moderator
21
Years of Service
User Offline
Joined: 19th Nov 2002
Location: UK
Posted: 18th Feb 2010 02:06
Quote: "I thought mid$() expects 3 things"


No - that's the way the rest of the programming world does it!

In DBP, like DBC, there are only two parameters.

TDK

TheComet
16
Years of Service
User Offline
Joined: 18th Oct 2007
Location: I`m under ur bridge eating ur goatz.
Posted: 18th Feb 2010 16:13 Edited at: 18th Feb 2010 16:14
Ah ok. Thanks TDK!

@DD

If you want to get more than one character, you can use:



TheComet

Latch
17
Years of Service
User Offline
Joined: 23rd Jul 2006
Location:
Posted: 18th Feb 2010 22:11
@TheComet
Nice way of doing mid$()! That's so much faster (and cleaner) than what I used to use which was a loop from the startpos to the finish position.

Enjoy your day.
Dark Dragon
16
Years of Service
User Offline
Joined: 22nd Jun 2007
Location: In the ring, Kickin\' *donkeybutt*.
Posted: 19th Feb 2010 01:18
Quote: "If you want to get more than one character, you can use:"


Clever! Never thought of doing it that way.......even though its not needed for what i'm doing now, i'll definatly remember it.

(\__/) HHAHAHAHAHAH!
(O.o ) / WORLD DOMINATION!!!!!!!!!!
(> < )

Login to post a reply

Server time is: 2024-04-25 12:16:16
Your offset time is: 2024-04-25 12:16:16