I have got a real problem getting this function to work and do not really understand why.

Code:
int CopyFiles(const std::string	&strFilePath1,
			  const std::string &strTargetPath,
			  std::vector<std::string> &vecFilesCopied)
{
	char *buffer = new char[strFilePath1.length()];
	int StringPos, Test, Counter;

	Test = _snprintf(buffer, strFilePath1.length(), strFilePath1.c_str());
         // blabla du some fancy stuff not causing any problems
	char *cTargetPath = new char[((strFilePath1.length()-StringPos) + strTargetPath.length())];
	Test = _snprintf(cTargetPath, strTargetPath.length(), strTargetPath.c_str());

	delete [] cTargetPath;
	delete [] buffer;
	return 0;
}
Now what happens is, that no matter what value strFilePath1.length() returns, strlen(buffer) always is 25.

The other problem I'm suffering from is, that I get a debug error when trying to delete both pointers.

Can anybody help me with this problem? Thank you very much in advance