?
Solved

char Replace

Posted on 2006-11-30
2
Medium Priority
?
228 Views
Last Modified: 2013-11-20
Hi guys,

I have this variable:

char TargetPath[500];

I want to search it for "/"
and replace them with "\"

Anyone able to help me out please?

Cheers!
0
Comment
Question by:Cyber-Drugs
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 14

Accepted Solution

by:
wayside earned 2000 total points
ID: 18048835
Well, you could put it into a CString and then use the .Replace function. :)

Otherwise you could do this:

int len = strlen(TargetPath);

for (int i=0; i<len; i++) {
  if (TargetPath[i] == '/')
   TargetPath[i] = '\\';
}
0
 
LVL 4

Author Comment

by:Cyber-Drugs
ID: 18049013
Haha, valid point, cheers wayside! :)
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Here is how to use MFC's automatic Radio Button handling in your dialog boxes and forms.  Beginner programmers usually start with a OnClick handler for each radio button and that's just not the right way to go.  MFC has a very cool system for handli…
Introduction: Database storage, where is the exe actually on the disc? Playing a game selected randomly (how to generate random numbers).  Error trapping with try..catch to help the code run even if something goes wrong. Continuing from the seve…
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…
Suggested Courses

777 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question