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 / string addittion problems

Author
Message
Night Giant
21
Years of Service
User Offline
Joined: 26th Jul 2003
Location:
Posted: 12th Feb 2004 04:35
hey all,
i'm having some trouble constructing a string. the line is:

destfile$=mapname$+"\Images\"+t+".png"

can anybody see a problem with this? It is really hindering my progress in my app. thanks in advance all. later.

oh, wow. insignificantpunks.cjb.net. we like orange treble clef notes, just for future reference.

no: website for progs yet.
Jess T
Retired Moderator
21
Years of Service
User Offline
Joined: 20th Sep 2003
Location: Over There... Kablam!
Posted: 12th Feb 2004 04:55 Edited at: 12th Feb 2004 04:55
The +t+ is the problem, it's not a string.
If 't' is holding a variable, such as an ID number, and you want it to be part of the string, you need to convert it to a string, which is relatively easy...

Just change the line to;

destfile$=mapname$+"Images"+Str$(t)+".png"

And you'll be right.

Hope I Helped...
Jess.


Team EOD :: Programmer/Logical Engineer/All-Round Nice Guy
Night Giant
21
Years of Service
User Offline
Joined: 26th Jul 2003
Location:
Posted: 12th Feb 2004 05:30
ah, once again jessticular to the rescue. i thank you mei amici.

oh, wow. insignificantpunks.cjb.net. we like orange treble clef notes, just for future reference.

no: website for progs yet.
Jess T
Retired Moderator
21
Years of Service
User Offline
Joined: 20th Sep 2003
Location: Over There... Kablam!
Posted: 12th Feb 2004 06:23
lol, Glad To Have Helped

Jess.


Team EOD :: Programmer/Logical Engineer/All-Round Nice Guy
Phaelax
DBPro Master
22
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 13th Feb 2004 03:52
I thought anything added to a string was automatically casted?

"eureka" - Archimedes
Jess T
Retired Moderator
21
Years of Service
User Offline
Joined: 20th Sep 2003
Location: Over There... Kablam!
Posted: 13th Feb 2004 11:01
Nope, that only works for integers to floats and vice-versa.

For strings, you have to declare them as a string ( ie, add the $ at the end of the variable ) or use the Str$() function to convert it to a string if it is already holding a number.

Jess.


Team EOD :: Programmer/Logical Engineer/All-Round Nice Guy

Login to post a reply

Server time is: 2025-05-22 20:13:58
Your offset time is: 2025-05-22 20:13:58