Solved

char Replace

Posted on 2006-11-30
2
219 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
2 Comments
 
LVL 14

Accepted Solution

by:
wayside earned 500 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

In this article, I'll describe -- and show pictures of -- some of the significant additions that have been made available to programmers in the MFC Feature Pack for Visual C++ 2008.  These same feature are in the MFC libraries that come with Visual …
Introduction: The undo support, implementing a stack. Continuing from the eigth article about sudoku.   We need a mechanism to keep track of the digits entered so as to implement an undo mechanism.  This should be a ‘Last In First Out’ collec…
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 Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.

910 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

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now