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.

Dark GDK / DarkDGK 2.0: Strings

Author
Message
Timidon
18
Years of Service
User Offline
Joined: 26th Jun 2005
Location: Bakersfield, Ca. USA.
Posted: 5th May 2013 23:42 Edited at: 5th May 2013 23:43
alright, I get confused a bit with strings, but getting better.

my question:

I can get

std::string sText;
sText = "Charles in Charge.";

dbText(100,100,sText);

this prints out normaly.

I want to just print out the say '5th' charcter

dbText(100,100,sText.at(5));

this gets a error:
Quote: "error C2664: 'dbText' : cannot convert parameter 3 from 'char' to 'std::string'"


The old db string commands do not seem to be in place as of yet.

Compiler is msvc 2008.

There are many answers but just one question" ~ Jerilith the Mad
Mr Bigglesworth
16
Years of Service
User Offline
Joined: 4th Mar 2008
Location:
Posted: 6th May 2013 06:08
Just create a second string with the nth character you want:

Timidon
18
Years of Service
User Offline
Joined: 26th Jun 2005
Location: Bakersfield, Ca. USA.
Posted: 6th May 2013 07:15
Thanks, been pouring over different examples all afternoon,trying currupting different methoods. Just came across the somehting similar, same concept.

There are many answers but just one question" ~ Jerilith the Mad
Timidon
18
Years of Service
User Offline
Joined: 26th Jun 2005
Location: Bakersfield, Ca. USA.
Posted: 8th May 2013 19:53
from what it looks like, The Game Creaters are pulling out the string and file functions from the newer version of DarkDGK?

There are many answers but just one question" ~ Jerilith the Mad
Rudolpho
18
Years of Service
User Offline
Joined: 28th Dec 2005
Location: Sweden
Posted: 9th May 2013 03:51
The idea behind that is that you might as well use the string / file handling functions / libraries already present for the language.

For C++ you have <string> and <fstream>.


"Why do programmers get Halloween and Christmas mixed up?"
Timidon
18
Years of Service
User Offline
Joined: 26th Jun 2005
Location: Bakersfield, Ca. USA.
Posted: 9th May 2013 03:57
Thats okay, just forcing me to use something new (well not so new). just trying to find the ways to convert a few into and out of the string format. I have sometimes a hard time wrapping my head around the code. I think I got almost everything I need to get restarted on my project. Just got to lick this point to the right directory and get my images loaded and I think I will be set to go.

I got a prototype read / write functions going, but getting the files to load from another directory is not working as planned (see another post).

There are many answers but just one question" ~ Jerilith the Mad

Login to post a reply

Server time is: 2024-04-25 10:32:27
Your offset time is: 2024-04-25 10:32:27