Gamestudio Links
Zorro Links
Newest Posts
Zorro 2.70
by jcl. 09/29/25 09:24
optimize global parameters SOLVED
by dBc. 09/27/25 17:07
ZorroGPT
by TipmyPip. 09/27/25 10:05
assetHistory one candle shift
by jcl. 09/21/25 11:36
Plugins update
by Grant. 09/17/25 16:28
AUM Magazine
Latest Screens
Rocker`s Revenge
Stug 3 Stormartillery
Iljuschin 2
Galactic Strike X
Who's Online Now
2 registered members (TipmyPip, 1 invisible), 18,731 guests, and 7 spiders.
Key: Admin, Global Mod, Mod
Newest Members
krishna, DrissB, James168, Ed_Love, xtns
19168 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
How can I directly access to a char of a string? [Solved] #240239
12/10/08 07:39
12/10/08 07:39
Joined: Jul 2008
Posts: 23
Turkey
H
Hatean Offline OP
Newbie
Hatean  Offline OP
Newbie
H

Joined: Jul 2008
Posts: 23
Turkey
I want to make some changes on a string and I have to access chars of that string. I tried _str and _chr but they are making so many stupid problems. Can't I access directly to chars in a string?

Note: I also tried "myString.chars[2]" but it doesn't work...

Thanks for helping...

Last edited by Hatean; 12/12/08 11:34.

The Life Game is disgustingly bad but the graphics and reality are extremely cool...
Re: How can I directly access to a char of a string? [Re: Hatean] #240292
12/10/08 12:18
12/10/08 12:18
Joined: Apr 2008
Posts: 594
Austria
Petra Offline
Support
Petra  Offline
Support

Joined: Apr 2008
Posts: 594
Austria
When you want to access single chars, (myString.chars)[i] is the right way. For the whole char array, use _chr(myString).

STRING* str = "12345";

function main()
{
printf("%x",(str.chars)[2]);
}

should give you 33, which is the character "3" in hex.

Re: How can I directly access to a char of a string? [Re: Petra] #240367
12/10/08 16:47
12/10/08 16:47
Joined: Jul 2008
Posts: 23
Turkey
H
Hatean Offline OP
Newbie
Hatean  Offline OP
Newbie
H

Joined: Jul 2008
Posts: 23
Turkey
It's working! I was using it wrong then. I m glad for your help. Thanks!


The Life Game is disgustingly bad but the graphics and reality are extremely cool...

Moderated by  HeelX, Lukas, rayp, Rei_Ayanami, Superku, Tobias, TWO, VeT 

Gamestudio download | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1