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.

AppGameKit Classic Chat / Working with Strings in Tier 2

Author
Message
Tobias_Ripper
11
Years of Service
User Offline
Joined: 24th Mar 2013
Location: REPCONN inc.
Posted: 30th Nov 2017 17:40 Edited at: 30th Nov 2017 17:53
Can't seem to print the String using agk:rint();
Visual studio keeps complaining that i'm not supplying a correct parameter type.



Another problem is that Whenever I supply an integer variable to be printed. It prints something else. Looks like an pointer or id of some sort.




If I declare the variable a a float, it seems to work, though. But that's just float values. I still need to convert it to a string and print that (mainly because I'm going to be working with individual characters of that string)


Eisenstadt Studio: Eisenstadtstudio.com
Composers Page: Milesthatch.net

Attachments

Login to view attachments
Tobias_Ripper
11
Years of Service
User Offline
Joined: 24th Mar 2013
Location: REPCONN inc.
Posted: 30th Nov 2017 18:35
I figured I'd move on to the next task at hand - Networking and low and behold, the example code uses strings too. So I'm officially stuck on this.
Eisenstadt Studio: Eisenstadtstudio.com
Composers Page: Milesthatch.net
Alex_Peres
AGK Master
15
Years of Service
User Offline
Joined: 13th May 2009
Location: The Milky Way Galaxy
Posted: 30th Nov 2017 19:19
use uString instead of std:string
MadBit
VIP Member
Gold Codemaster
15
Years of Service
User Offline
Joined: 25th Jun 2009
Location: Germany
Posted: 30th Nov 2017 22:38 Edited at: 30th Nov 2017 22:40
You can also use agk :: Print(temp.c_str())

With your integer number, you have a number overflow. Integer number range (32 bit) = -2,147,483,648 to 2,147,483,647. If you took an unsigned integer (unsigned int) instead of the integer (int), that would not help either (range 0 to 4,294,967,295). The solution is to rethink whether you need such huge numbers? Or take 64 bit integers.

The example should look like this.

Something like that (not tested)
Share your knowledge. It\'s a way to achieve immortality. (Tenzin Gyatso)
Stab in the Dark software
Valued Member
21
Years of Service
User Offline
Joined: 12th Dec 2002
Playing: Badges, I don't need no stinkin badges
Posted: 30th Nov 2017 23:12
I use uString, here is an example.

The coffee is lovely dark and deep,and I have code to write before I sleep.

Login to post a reply

Server time is: 2024-11-24 06:33:23
Your offset time is: 2024-11-24 06:33:23