예제 #1
0
파일: MyString.cpp 프로젝트: styxschip/Note
CMyString& CMyString::Append(const char *pszName)
{
  int nLength = strlen(pszName) + m_nLength;
  
  //空间不够
  if (nLength >= m_nSize)
  {
    //申请新空间
    char *lpNewBuff = AllocBuff(nLength + 1);
    

    //拷贝旧的数据
    strcpy(lpNewBuff, m_pBuff);

    //释放旧空间
    FreeBuff();
    m_pBuff = lpNewBuff;

    m_nSize = nLength + 1;
  }
  
  if (m_pBuff != NULL)
    strcat(m_pBuff, pszName);
  m_nLength = nLength;

  return *this;
}
예제 #2
0
bool TYPBLK<TYPE>::Init(PGLOBAL g, bool check)
  {
  if (!Blkp)
    if (AllocBuff(g, Nval * sizeof(TYPE)))
      return true;

  Check = check;
  Global = g;
  return false;
  } // end of Init
예제 #3
0
bool STRBLK::Init(PGLOBAL g, bool check)
  {
  if (!Blkp)
    if (AllocBuff(g, Nval * sizeof(PSZ)))
      return true;

  Check = check;
  Global = g;
  return false;
  } // end of Init
예제 #4
0
bool CHRBLK::Init(PGLOBAL g, bool check)
  {
  Valp = (char*)PlugSubAlloc(g, NULL, Long + 1);
  Valp[Long] = '\0';

  if (!Blkp)
    if (AllocBuff(g, Nval * Long))
      return true;

  Check = check;
  Global = g;
  return false;
  } // end of Init
예제 #5
0
파일: MyString.cpp 프로젝트: styxschip/Note
CMyString& CMyString::SetString(const char *pszName)
{
  int nLength = strlen(pszName);

  //空间不够
  if (nLength >= m_nSize)
  {
    //释放旧空间
    FreeBuff();

    //申请新空间
    m_pBuff = AllocBuff(nLength + 1);
    m_nSize = nLength + 1;
  }

  if (m_pBuff != NULL)
      strcpy(m_pBuff, pszName);
  m_nLength = nLength;
  return *this;
}