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 / Char* Replace

Author
Message
AlexI
19
Years of Service
User Offline
Joined: 31st Dec 2004
Location: UK
Posted: 11th Sep 2008 11:51 Edited at: 11th Sep 2008 16:16
Hi,
How can i do a search & replace on char* from to /

Also / is weird its an escape character i don't know what C++ is to stop that,

Thanks,
Alex

IanM
Retired Moderator
22
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 11th Sep 2008 15:37


It's the backslash that's the escape character - as you can see in the above code, I've had to escape the escape character to detect it.

AlexI
19
Years of Service
User Offline
Joined: 31st Dec 2004
Location: UK
Posted: 11th Sep 2008 16:17
Thanks, will test it when i get back from college

AlexI
19
Years of Service
User Offline
Joined: 31st Dec 2004
Location: UK
Posted: 12th Sep 2008 16:29 Edited at: 12th Sep 2008 16:33
Hi,
Thanks, Any ideas why this code didn't work

Me using code:


My errors:



Thanks,
Alex

Lilith
16
Years of Service
User Offline
Joined: 12th Feb 2008
Location: Dallas, TX
Posted: 12th Sep 2008 16:53 Edited at: 12th Sep 2008 16:54
Try



You're trying to compare what a pointer is pointing to by dereferencing Ptr (*Ptr) with the actual value of a pointer. You need to deference the pointer on the right of the == to compare a char to a char.

Lilith, Night Butterfly
I'm not a programmer but I play one in the office
AlexI
19
Years of Service
User Offline
Joined: 31st Dec 2004
Location: UK
IanM
Retired Moderator
22
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 12th Sep 2008 19:13
I'd suggest that you change that function slightly - passing a char pointer for the find & replace values gives the incorrect impression that it's a string replacement function, not a character replacement function:


Login to post a reply

Server time is: 2024-09-30 05:19:38
Your offset time is: 2024-09-30 05:19:38