//---------------------------------------------------------------------------

#include <vcl.h>
#pragma hdrstop

#include "SysUtilsStrMove.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TForm1 *Form1;
//---------------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner)
	: TForm(Owner)
{
}
//---------------------------------------------------------------------------
// BeginExample: SysUtilsStrMove
// Routine: SysUtils.StrMove

// BeginCode
/*
This example shows two functions that do the same thing as
StrNew and StrDispose.
*/
char * AHeapaString(char *S)
{
// Allocate string on heap
  if ((S != NULL) && (S[0] != '\0'))
  {
    int L = StrLen(S) + 1;
    char *p = (char *)malloc(L);
    return StrMove(p, S, L);
  }
  return NULL;
}
void DisposeDaString(char *S)
{
// Dispose string on heap
  if (S != NULL)
    free(S);
}
void __fastcall TForm1::Button1Click(TObject *Sender)
{
  char *S = "Now you see it.";
  char *otherS = AHeapaString(S);
  Canvas->TextOut(5, 10, otherS);
  Canvas->Refresh();
  Sleep(5000);
  DisposeDaString(otherS);
}
// EndCode
// EndExample: SysUtilsStrMove
//---------------------------------------------------------------------------
