har Copy chara Text size_t Len int Pos if Text if Len Pos Text Len ret

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
har* Copy( chara Text, size_t Len, int Pos )
{
if(Text > 0)
{
if(Len + Pos > Text.Len()) return "";
char* ToReturn = new(std::nothrow) char[Len + 1];
for( int i = Pos; i < Len + Pos; i++ )
ToReturn[i - Pos] = Text[i];
ToReturn[Len] = '\0';
return ToReturn;
}
else return "";
}