Quantcast
Channel: Visual C forum
Viewing all articles
Browse latest Browse all 15302

error C2664: 'std::_String_iterator std::basic_string::insert(std::_String_const_iterator,std::_String_const_iterator

$
0
0

Hi

I am migrating my application from vc++6.0 to vc++2013, iam getting some errors

These error have occured in 2 different places.

i am displaying my code below and highlighting the 2 error line...which u will find way below.

=======================CODE========================

#include "stdafx.h"
#include "COLATools.h"
#include "COLAStrings.h"

/////////////////////////////////////////////////////////////////////////////
// CCOLAStrings

const TCHAR CCOLAStrings::TRANSLIST[] = "ßstuvwxyzäABCDEFGHIüJKLMNOPQRÖSTUVWXYZ0123456789";
const TCHAR CCOLAStrings::DIGITLIST[] = "123456789012345678901234567890234567890123456789";


STDMETHODIMP CCOLAStrings::InterfaceSupportsErrorInfo(REFIID riid)
{
 static const IID* arr[] =
 {
  &IID_ICOLAStrings
 };
 for (int i=0; i < sizeof(arr) / sizeof(arr[0]); i++)
 {
  if (InlineIsEqualGUID(*arr[i],riid))
   return S_OK;
 }
 return S_FALSE;
}


STDMETHODIMP CCOLAStrings::SetConnection(BSTR connection)
{
 // Check argument
 if ( NULL == connection )
 {
  this->Error(IDS_ERR_CONNECTION_MISSING, IID_ICOLAStrings, E_INVALIDARG);
 }
 USES_CONVERSION;
 m_oSql.SetConnectionName(OLE2CT(connection));

 return S_OK;
}


/** Computes the the SearchName for the database table "person_alias" which
 allows a better search for surnames in the database. Therefor the name
 is transformend in lower letters and every special character is eliminated.

  @param, in: BSTR with the source
  @param, out: BSTR with the calulated searchName as result
 */
 
STDMETHODIMP CCOLAStrings::CalculateSearchName(BSTR szName, BSTR *szSearchName)
{
 if (szName == NULL)
  return this->Error(IDS_ERR_NAME_MISSING, IID_ICOLAStrings, E_FAIL);

 tstring szTempName(szName);
 tstring szErg;
 TCHAR cLetter;
 tstring::size_type lLength = szTempName.length();

 try
 {
  for (tstring::size_type i = 0; i < lLength ; i++)
  {
   cLetter = szTempName.at(i);

   // Handling for "normal" characters ...
   if ((cLetter >= 'a' && cLetter <= 'z') || cLetter == '%'  ||
    (cLetter >= '0' && cLetter <= '9') || cLetter == '_')
    szErg.append(1, cLetter);
   else
   {
    if (cLetter >= 'A' && cLetter <= 'Z')
    {
     cLetter += 32;
     szErg.append(1, cLetter);
    }
    else
    {
     switch(cLetter)
     {
      case 'Ä' : case 'ä' : case 'Æ' : case 'æ' :
       szErg.append("ae");
       break;
 
      case 'Œ' : case 'œ' : case 'ö' : case 'Ö' :
       //szErg.append("ue"); //Kintana: 47837: Commented out for Umlaut problem
       szErg.append("oe");  //Kintana: 47837: Added for Umlaut problem
       break;

      case 'Ü' : case 'ü' :
       szErg.append("ue");
       break;

      case 'ß' :
       szErg.append("ss");
       break;

      case 'Š' : case 'š' :
       szErg.append(1, 's');
       break;

      case 'Ÿ' : case 'ÿ' : case '¥' :
       szErg.append(1, 'y');
       break;

      case '¢' : case 'Ç' : case 'ç' :
       szErg.append(1, 'c');
       break;

      case 'À' : case 'Á' : case 'Â' : case 'Ã' : case 'Å' :
      case 'à' : case 'á' : case 'â' : case 'ã' : case 'å' :
       szErg.append(1, 'a');
       break;

      case 'È' : case 'É' : case 'Ê' : case 'Ë' : case 'è' :
      case 'é' : case 'ê' : case 'ë' :
       szErg.append(1, 'e');
       break;

      case 'Ì' : case 'Í' : case 'Î' : case 'Ï' : case 'ì' :
      case 'í' : case 'î' : case 'ï' :
       szErg.append(1, 'i');
       break;

      case 'Ð' : case 'ð' :
       szErg.append(1, 'd');
       break;
  
      case 'Ñ' : case 'ñ' :
       szErg.append(1, 'n');
       break;

      case 'Ò' : case 'Ó' : case 'Ô' : case 'Õ' : case 'Ø' :
      case 'ò' : case 'ó' : case 'ô' : case 'õ' : case 'ø' :
       szErg.append(1, 'o');
       break;

      case 'Ù' : case 'Ú' : case 'Û' : case 'ù' : case 'ú' :
      case 'û' :
       szErg.append(1, 'u');
     }
    }
   }
  }
 }
 catch (std::exception &e) {
  return this->Error(e.what(), IID_ICOLAStrings, E_FAIL);
 }

 CComBSTR szTrans(szErg);
 return szTrans.CopyTo(szSearchName);
}


/** Calulates a soundex for the giving text. After some steps with preparation
 the soundex is generated by the database using a stored procedure.

 @param, in:  A BSTR with the the text that is the source for the
      computing soundex
 @param, out: The result is an BSTR with the soundex of the text.
 */

STDMETHODIMP CCOLAStrings::CalculateSoundex(BSTR szText, BSTR *szSoundex)
{
 if (szText == NULL)
  return this->Error(IDS_ERR_NAME_MISSING, IID_ICOLAStrings, E_FAIL);

 tstring szTemp(szText);
 tstring szErg;
 tstring::size_type lPos;
 TCHAR cHelp;

 try
 {
  // converting the first letter of the name ...
  for (lPos = 0; lPos < szTemp.length() && szErg.length() == 0; lPos++)
  {
   cHelp = this->ConvertSpecialVocal(szTemp.at(lPos));
   if (cHelp != '\0') szErg += cHelp;
   szErg += this->ConvertSpecialConsonat(szTemp.at(lPos));
   cHelp = this->EleminateNoletter(szTemp.at(lPos));
   if (cHelp != '\0') szErg += cHelp;
  }

  // converting the rest of the string ...
  for (; lPos < szTemp.length(); lPos++)
  {
   szErg += this->ConvertSpecialConsonat(szTemp.at(lPos));
   cHelp = this->EleminateNoletter(szTemp.at(lPos));
   if (cHelp != '\0') szErg += cHelp;
  }
 }
 catch (std::exception &e) {
  return this->Error(e.what(), IID_ICOLAStrings, E_FAIL);
 }

 // calling a stored procedure in the database to generate the soundex ...
 try
 {
  if (! m_oSql.ComputeSoundex(szErg))
   return this->Error(IDS_ERR_STPROC, IID_ICOLAStrings, E_FAIL);
 }
 catch (CSQLException &e)
 {
  return this->Error(e.m_szMsg.c_str(), IID_ICOLAStrings, E_FAIL);
 }

 CComBSTR szBSTRTemp(szErg);
 szBSTRTemp.CopyTo(szSoundex);

 return S_OK;
}


/** Converts some special/national vocals to a standard representation. If no
 special or national vocal could be found, the method returns a Null.

 @param, in:  A character to examine
 @param, out: The transformed character. If no transforming is done,
      than it returns 0.
 */

TCHAR CCOLAStrings::ConvertSpecialVocal(TCHAR cLetter)
{
 if ((cLetter >= 'À' && cLetter <= 'Æ') || (cLetter >= 'à' && cLetter <= 'æ'))
  return ('a');

 if ((cLetter >= 'È' && cLetter <= 'Ë') || (cLetter >= 'è' && cLetter <= 'ë'))
  return ('e');

 if ((cLetter >= 'Ì' && cLetter <= 'Ï') || (cLetter >= 'ì' && cLetter <= 'ï'))
  return ('i');

 if (cLetter == 'Œ' || cLetter == 'œ' || cLetter == 'ø' || (cLetter >= 'Ò' &&
  cLetter <= 'Ö') || (cLetter >= 'ò' && cLetter <= 'ö') || cLetter == 'Ø')
  return ('o');

 if ((cLetter >= 'Ù' && cLetter <= 'Ü') || (cLetter <= 'ù' && cLetter >= 'ü'))
  return ('u');

 return ('\0');
}


/** Transformes special/national consonants to a "normal" representation.

 @param, in:  The character which should be examined.
 @param, out: The "normal" representation, if the character has been
      special or national. If no converting has been done, the
      return is 0.
 */

tstring CCOLAStrings::ConvertSpecialConsonat(TCHAR cLetter)
{
 tstring szErg;

 switch (cLetter)
 {
  case 'ß' :
   szErg.append("ss");
   break;
  case 'š' :
  case 'Š' :
   szErg.append(1, 's');
   break;
  case 'Ð' :
  case 'ð' :
   szErg.append(1, 'd');
   break;
  case 'Ñ' :
  case 'ñ' :
   szErg.append(1, 'n');
   break;
  case 'Ÿ' :
  case 'ÿ' :
  case 'ý' :
  case 'Ý' :
   szErg.append(1, 'y');
 }
 
 return (szErg);
}


/** This method filters the non-letter characters, so only the letters
 passes throught the method. For Letters the case is unimportant.

 @param, in:  The letter, which should be examined.
 @param, out: If the in-parameter is a letter, then it is returned,
      otherwise a 0 is given back.
 */

TCHAR CCOLAStrings::EleminateNoletter(TCHAR cLetter)
{
 if ((cLetter >= 'A' && cLetter <= 'Z') || (cLetter >= 'a' && cLetter <= 'z'))
  return (cLetter);
 
 return ('\0');
}


// Clears the value of the member variables holding the name parts.
STDMETHODIMP CCOLAStrings::ResetNameParts()
{
 m_szAddings = "";
 m_szFirstname = "";
 m_szSurname = "";
 return S_OK;
}


// Removes leading and trailing spaces from the string.
tstring& CCOLAStrings::Trim(tstring& szToken)
{
 long lDelFront = 0, lDelBack = 0;

 while (lDelFront < szToken.length() && szToken.at(lDelFront) == ' ')
  lDelFront++;
 szToken.erase(0, lDelFront);

 while (lDelBack < szToken.length() &&
  szToken.at(szToken.length() - lDelBack - 1) == ' ')
  lDelBack++;

 szToken.erase(szToken.length() - lDelBack, lDelBack);
 return (szToken);
}


// Adds a new Token to the given string. All tokens are separated with one
// space.
void CCOLAStrings::AddToken(tstring &szString, tstring szToken)
{
 if (szString.length() > 0) szString.append(_T(" "));
 szString.append(this->Trim(szToken));
}


// Finds the addings from the given name and puts them into the
// variable m_szAddings. The rest is stored in szResult.
void CCOLAStrings::Split(tstring szName, CComBSTR &szResult)
{
 tstring szAdd, szTemp;
 long lPosOld = 0, lPosNew;
 szName += " ";

 while (true)
 {
  // Search for spaces, dots and apostrophes as delimeters
  lPosNew = szName.find(' ', lPosOld);
  lPosNew = min(lPosNew, szName.find('\'', lPosOld));
  lPosNew = min(lPosNew, szName.find('.', lPosOld));
  if (lPosNew == tstring::npos)
   break;

  // There is at least one delimeter found. Now we check, if the adding
  // is known.
  szTemp.assign(szName, lPosOld, lPosNew - lPosOld);
  szTemp.assign(_tcslwr(const_cast<TCHAR *>(szTemp.c_str())));
  if (((szTemp == _T("von") || szTemp == _T("der") || szTemp == _T("van")
   || szTemp == _T("de") || szTemp == _T("freifrau") || szTemp ==
   _T("freiherr") || szTemp == _T("dr.") || szTemp == _T("vom") ||
   szTemp == _T("den") || szTemp == _T("la") || szTemp == _T("del")
   || szTemp == _T("dell") || szTemp == _T("della") || szTemp == _T("di")
   || szTemp == _T("di-") || szTemp == _T("ladron")) && szName.at(lPosNew) == ' ') ||
   (szName.at(lPosNew) == '\'' && szTemp == _T("d")) ||
   (szName.at(lPosNew) == '.' && szTemp == _T("dr")))
  {
   this->AddToken(szAdd, tstring(szName, lPosOld, lPosNew - lPosOld + 1));
   szName.erase(lPosOld, lPosNew - lPosOld + 1);
   lPosNew = lPosOld - 1;
  }
  lPosOld = lPosNew + 1;
 }
 if (m_szAddings.Length() > 0 && szAdd.length() > 0)
  m_szAddings.Append(" ");
 m_szAddings.Append(this->Trim(szAdd));
 szResult.Append(this->Trim(szName));
}


// Splitting a name into two ore more parts. These are the first name, the
// surname and some name addings. Because the handling including the first name
// is some more difficulty we use two methods.
STDMETHODIMP CCOLAStrings::SplitSurname(BSTR szName)
{
 if (szName == NULL)
 {
  return this->Error(IDS_ERR_ARG_MISSING, IID_ICOLAStrings, E_FAIL);
 }

 try
 {
  this->Split(tstring(szName), m_szSurname);

  // if surname is now empty we take last token of name addings
  // and move it to the surname
  this->CheckSurname();
 }
 catch (std::exception &e)
 {
  return this->Error(e.what(), IID_ICOLAStrings, E_FAIL);
 }
 return S_OK;
}


void CCOLAStrings::CheckSurname()
{
 // if surname is now empty we take last token of name addings
 // and move it to the surname
 if (0 == m_szSurname.Length())
 {
  tstring szAddings(m_szAddings);

  tstring::size_type p = szAddings.rfind(' ');
  if (tstring::npos == p)
  {
   p = 0;
  }
  
  m_szSurname.Append(this->Trim(reinterpret_cast<tstring&>(szAddings.substr(p))));

  m_szAddings.Empty();
  m_szAddings.Append(this->Trim(reinterpret_cast<tstring&>(szAddings.substr(0, p))));
 }
}


// Split the name addings from the first name (if exitst)
STDMETHODIMP CCOLAStrings::SplitFirstname(BSTR firstName)
{
 if (firstName == NULL)
  return this->Error(IDS_ERR_ARG_MISSING, IID_ICOLAStrings, E_FAIL);

 try {
  this->Split(tstring(firstName), m_szFirstname);
 }
 catch (std::exception &e) {
  return this->Error(e.what(), IID_ICOLAStrings, E_FAIL);
 }
 return S_OK;
}


// Splits a complete name, includung the firstname. The rest of the name
// is handelt by SplitSurname.
STDMETHODIMP CCOLAStrings::SplitName(BSTR szName, BOOL bFirstNameFirst,
             BSTR szFirstNameDelimiter)
{
 if (szName == NULL || szFirstNameDelimiter == NULL)
  return this->Error(IDS_ERR_ARG_MISSING, IID_ICOLAStrings, E_FAIL);

 this->ResetNameParts();

 // find the first name
 tstring szN;
 tstring szFN;
 tstring szDelimiter(szFirstNameDelimiter);
 long lPos;

 try
 {
  // get addings from name
  CComBSTR szNameWithoutAddings;
  this->Split(szName, szNameWithoutAddings);
  szN = szNameWithoutAddings;

  // Now get first/surname
  if (VARIANT_TRUE == bFirstNameFirst)
  {
   if ((lPos = szN.find_last_of(szDelimiter)) != tstring::npos)
   {
    szFN.assign(szN, 0, lPos);
    szN.erase(0, lPos);
   }
  }
  else
  {
   if ((lPos = szN.find_first_of(szDelimiter)) != tstring::npos)
   {
    szFN.assign(szN, lPos + 1, szN.length() - lPos);
    szN.erase(lPos, szN.length() - lPos);
   }
  }
  m_szFirstname = this->Trim(szFN);
  
  m_szSurname = this->Trim(szN);
  this->CheckSurname();
 }
 catch (std::exception &e)
 {
  return this->Error(e.what(), IID_ICOLAStrings, E_FAIL);
 }
 
 return S_OK;
}


// The following methods will return the Values of the properties for
// first-, surname and name addings.
STDMETHODIMP CCOLAStrings::get_FirstName(BSTR *pVal)
{
 return m_szFirstname.CopyTo(pVal);
}


STDMETHODIMP CCOLAStrings::get_Surname(BSTR *pVal)
{
 return m_szSurname.CopyTo(pVal);
}


STDMETHODIMP CCOLAStrings::get_Addings(BSTR *pVal)
{
 return m_szAddings.CopyTo(pVal);
}


// Unpacks a host based numbers. The format assumed for this numbers is not
// the complete cobol packed format.
STDMETHODIMP CCOLAStrings::UnpackNumber(BSTR packed, double *unpacked)
{
 if (packed == NULL)
  return this->Error(IDS_ERR_ARG_MISSING, IID_ICOLAStrings, E_FAIL);

 double dResult = 0;
 tstring szPacked(packed);

 try
 {
  // Interpret all numbers in the string. The first occurence of a non
  // number character stops the loop.
  
  for (tstring::iterator it = szPacked.begin(); it != szPacked.end(); it++)
  {
   if (*it >= '0' && *it <= '9')
    dResult = dResult * 10 + (*it - '0');
   else
    break;
  }

  // If there is a non number character at the end, it is interpreted ...
  if ( it != szPacked.end())
  {
   // Find the position in the translist string.
   tstring::size_type lPos = tstring(TRANSLIST).find(*it);
   if (lPos != tstring::npos)
   {
    // Put the last digit
    dResult = dResult * 10 + (DIGITLIST[lPos] - '0');

    // These positions mark a negative number
    if (lPos > 18 && lPos < 29)
     dResult *= -1;
   }
   else
    return this->Error(IDS_ERR_NUMBER, IID_ICOLAStrings, E_FAIL);

   // Find out, if threre are following numbers or letters. This
   // causes an error.
   for (it++; it != szPacked.end(); it++)
   {
    if (*it != ' ')
     break;
   }
   if (it != szPacked.end())
    return this->Error(IDS_ERR_NUMBER, IID_ICOLAStrings, E_FAIL);
  }
 }
 catch (std::exception &e) {
  return this->Error(e.what(), IID_ICOLAStrings, E_FAIL);
 }

 *unpacked = dResult;
 return S_OK;
}


STDMETHODIMP CCOLAStrings::BStr2Double(BSTR value, double *result)
{
 *result = .0;
 double sign = 1;
 int fracCount = 1;
 tstring szItem(value);

 for (tstring::const_iterator it = szItem.begin(); it != szItem.end(); it++)
 {
  TCHAR ch = *it;

  if (ch >= '0' && ch <= '9')
  {
   if (1 == fracCount)
   {
    (*result) = (*result) * 10 + (ch - '0');
   }
   else
   {
    double fract = ((double) (ch - '0')) / fracCount;
    (*result) += fract;
    fracCount *= 10;
   }
  }
  else if ('-' == ch || 'ý' == ch)
  {
   sign = -1;
  }
  else if ('.' == ch)
  {
   fracCount = 10;
  }
 }

 *result = (sign * (*result));
 return S_OK;
}


// Implements the type conversion of different types into a date value
//
STDMETHODIMP CCOLAStrings::CDate(VARIANT input, BSTR format, DATE *result)
{
 SYSTEMTIME tm;
 ::memset(&tm, 0, sizeof(tm));

 try
 {
  if (VT_BSTR == input.vt)
  {
   tstring szFormat(format);
   tstring szSource(input.bstrVal);
   tstring::iterator itFormat = szFormat.begin();
   tstring::iterator itSrc = szSource.begin();

   for (; itFormat != szFormat.end() && itSrc != szSource.end(); itFormat++)
   {
    if (*itFormat == 'd' || *itFormat == 'D' || *itFormat == 'm' || *itFormat == 'M' ||
     *itFormat == 'y' || *itFormat == 'Y' || *itFormat == 'h' || *itFormat == 'H' ||
     *itFormat == 'n' || *itFormat == 'N' || *itFormat == 's' || *itFormat == 'S')
    {
     if (itSrc != szSource.end() && *itSrc >= '0' && *itSrc <= '9')
     {
      int iErg = *itSrc - '0';
      itSrc++;

      switch (*itFormat)
      {
       case 'D' : case 'd' :
        tm.wDay = tm.wDay * 10 + iErg;
        break;

       case 'M' : case 'm' :
        tm.wMonth = tm.wMonth * 10 + iErg;
        break;

       case 'Y' : case 'y' :
        tm.wYear = tm.wYear * 10 + iErg;
        break;

       case 'H' : case 'h' :
        tm.wHour = tm.wHour * 10 + iErg;
        break;

       case 'N' : case 'n' :
        tm.wMinute = tm.wMinute * 10 + iErg;
        break;

       case 'S' : case 's' :
        tm.wSecond = tm.wSecond * 10 + iErg;
        break;
      }
     }
    }
    else
    {
     if (*itFormat == *itSrc)
     {
      itSrc++;
     }
    }
   }

  }
  else if (VT_I4 == input.vt)
  {
   int src = input.intVal;

   tm.wYear = src / 10000;
   tm.wMonth = (src % 10000) / 100;
   tm.wDay = src % 100;
  }
  else
  {
   return this->Error(_T("Unkown type in CDate"), IID_ICOLAStrings, E_FAIL);
  }
 }
 catch (std::exception &e)
 {
  return this->Error(e.what(), IID_ICOLAStrings, E_FAIL);
 }

 return this->CheckAndConvertDate(&tm, result);
}


/**
 * Checks the date in tm and if no errors where found it transforms this by
 * using the system function SystemTimeToVariantTime in a DATE format.
 */
HRESULT CCOLAStrings::CheckAndConvertDate(SYSTEMTIME *tm, DATE *d)
{
 HRESULT hRC;

 if (tm == NULL)
  return this->Error("Invalid (null) param", IID_ICOLAStrings, E_FAIL);

 hRC = (tm->wMonth < 1 || tm->wMonth > 12 || tm->wHour > 23 || tm->wMinute > 59
  || tm->wDay < 1 || tm->wDay > 31 || tm->wSecond > 59) ? E_FAIL : S_OK;

 if (SUCCEEDED(hRC))
 {
  switch (tm->wMonth)
  {
   case 4 : case 6: case 9 : case 11 :
    hRC = (tm->wDay > 30) ? E_FAIL : hRC;
    break;
   case 2 :
    if (tm->wYear % 4 == 0 && (tm->wYear % 100 != 0 || tm->wYear % 400 == 0))
     hRC = (tm->wDay > 29) ? E_FAIL : hRC;
    else
     hRC = (tm->wDay > 28) ? E_FAIL : hRC;
  }
 }
 
 if (FAILED(hRC))
 {
  return this->Error("Cannot convert to date because of wrong values", IID_ICOLAStrings, E_FAIL);
 }

 return SystemTimeToVariantTime(tm, d);
}


// Converts differnt types into a BSTR value.
//
STDMETHODIMP CCOLAStrings::CBSTR(VARIANT input, BSTR *result)
{
 HRESULT ret = S_OK;
 tstring res;

 if (VT_I4 == input.vt || VT_I2 == input.vt)
 {
  int val = (VT_I4 == input.vt) ? input.intVal : input.iVal;

  if (val < 0)
  {
   res += '-';
   val *= -1;
  }
  while (val > 0)
  {
   TCHAR n = static_cast<TCHAR>((val % 10) + '0');
   res.insert(0, n); error

   val = val / 10;
  }
 }
 else if (VT_R8 == input.vt || VT_CY == input.vt)
 {
  if (VT_CY == input.vt)
  {
   ::VariantChangeType(&input, &input, VARIANT_NOVALUEPROP, VT_R8);
  }

  double val = input.dblVal;

  if (val < 0.0)
  {
   res += '-';
   val *= -1.0;
  }
  int iVal = static_cast<int>(val);
  double dblFrac = val - static_cast<double>(iVal);

  // Figures before .
  while (iVal > 0)
  {
   TCHAR n = static_cast<TCHAR>((iVal % 10) + '0');
   res.insert(0, n); //error
   iVal = iVal / 10;
  }

  if (dblFrac > .001)
  {
   res.append(1, '.');

   // Figures after .
   while (dblFrac > 0.001)
   {
    dblFrac *= 10;
    int iFrac = static_cast<int>(dblFrac);

    TCHAR n = static_cast<TCHAR>((iFrac % 10) + '0');
    res.append(1, n);

    dblFrac = dblFrac - iFrac;
   }
  }
 }
 else if (VT_DATE == input.vt)
 {
  SYSTEMTIME tm;
  TCHAR szBuffer[10];

  ::VariantTimeToSystemTime(input.date, &tm);

  ::_itot(tm.wYear, szBuffer, 10);
  res.append(szBuffer);
  res.append(_T("."));

  ::_itot(tm.wMonth, szBuffer, 10);
  if (tm.wMonth < 10)
  {
   res.append(_T("0"));
  }
  res.append(szBuffer);
  res.append(_T("."));

  ::_itot(tm.wDay, szBuffer, 10);
  if (tm.wDay < 10)
  {
   res.append(_T("0"));
  }
  res.append(szBuffer);
 }
 else if (VT_BSTR == input.vt)
 {
  res = input.bstrVal;
 }
 else
 {
  return this->Error(_T("Unkown source type"), IID_ICOLAStrings, E_FAIL);
 }

 CComBSTR szHelp(res.c_str());
 szHelp.CopyTo(result);
 return ret;
}

 

STDMETHODIMP CCOLAStrings::Trim(BSTR source, BSTR *output)
{
 tstring szSource(source);
 CComBSTR szHelp(szSource.trim());

 szHelp.CopyTo(output);

 return S_OK;
}

======================CODE==============================

These error is in one of the cpp file.can anyone guide me through this

Thanks Ankush


Viewing all articles
Browse latest Browse all 15302

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>