Gamestudio Links
Zorro Links
Newest Posts
ZorroGPT
by TipmyPip. 08/22/26 08:44
Max Number of Strategies in /Strategy folder
by Martin_HH. 08/17/26 07:54
Pause button for evaluation shell?
by AndrewAMD. 08/13/26 17:16
Sam Foster Sound | Experienced Game Composer for Hire
by titanicpiano14. 08/10/26 12:46
phantom() not defined in indicators.c
by jcl. 08/07/26 11:45
AUM Magazine
Latest Screens
Dorifto samurai
Shadow 2
Rocker`s Revenge
Stug 3 Stormartillery
Who's Online Now
2 registered members (NorbertSz, EW_bytes), 3,144 guests, and 2 spiders.
Key: Admin, Global Mod, Mod
Newest Members
riggi89, shuhari, KD1990, Student_64151, Koti
19230 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: 600
Austria
Petra Offline
Support
Petra  Offline
Support

Joined: Apr 2008
Posts: 600
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