473,386 Members | 1,958 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Why is .copy adding duplicate characters to one word?

Ajm113
161 100+
For some reason when I try to pass a string that is this:

'man!';

Into the first param of copy and the value of 4 in to the second param and 6 into the last argument for some reason copy is adding duplicate characters in the string. Then it comes out like so:

man!!';

It's kinda odd because if I form the string into a sentence it works fine, because of the spaces can someone help me out why it's doing this? I just want it to get the man! part. Just exclude the '; part.

Code:
Expand|Select|Wrap|Line Numbers
  1.                 size_t i_mFound;
  2.     int RB;
  3.     int RE;
  4.     int length;
  5.  
  6.     i_mFound = sData.find("'");
  7.  
  8.  
  9.     if (i_mFound!=std::string::npos) {
  10.      RB = int(i_mFound);
  11.      RB++;
  12.  
  13.     }
  14.  
  15.  
  16.     i_mFound = sData.find("';");
  17.         if (i_mFound!=std::string::npos) {
  18.         RE = int(i_mFound);
  19.         }
  20.         length = RE - RB;
  21.         length=sData.copy(szFilename,length,RB);
Jun 12 '08 #1
1 1895
jwwicks
19
Did you initialize szFilename... I ran the code and seems to work as expected.

I just init szFilename like so...

char szFilename[1024] = {0};

JW
Aug 8 '08 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

7
by: Voetleuce en fênsievry | last post by:
Hello everyone. I'm not a JavaScript author myself, but I'm looking for a method to remove duplicate words from a piece of text. This text would presumably be pasted into a text box. I have,...
0
by: **Developer** | last post by:
I need to copy some text to the clipboard so that Word can paste it. The text contains characters that have no ANSI equivalent. If I simply put the text on the Clipboard, Word displays these...
6
by: Robin S. | last post by:
**Eric and Salad - thank you both for the polite kick in the butt. I hope I've done a better job of explaining myself below. I am trying to produce a form to add products to a table (new...
0
by: David Carwile | last post by:
I have a treeview control which populates from a table in a database. Some nodes in the control contain long discription blocks and I have broken them up using a word wrap function I wrote. The...
11
by: Danny J. Lesandrini | last post by:
Has anyone else noticed this? I searched group archives and found nothing, but it's really starting to irritate me big time. Here's the steps to reproduce the problem: Copy something to the...
19
by: davidgordon | last post by:
Hi, I need some pointers/help on how to do the following if it possible: In my access db, I have the following: Tables: Products, Sub-Assembly, Product-Pack Table, Products
1
by: Jeffrey Bradshaw | last post by:
Is there any way to make a copy of a word.range object? I have a range in a document and I need to monkey around with it but I don't want to change the original in the document. I've tried...
7
by: lgbjr | last post by:
Hello All, I¡¯m using a context menu associated with some pictureboxes to provide copy/paste functionality. Copying the image to the clipboard was easy. But pasting an image from the clipboard...
3
by: tom.henricksen | last post by:
We have a web page where application users are coping and pasting some text from WordPerfect or MS Word. We have noticed some of the characters are unreadable. These characters have special...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.