while(gotdat.Pos('\0') > 0){
lng_pos = gotdat.Pos('\0');
strtmp = gotdat.SubString(1,lng_pos-1);
gotdat = strtmp + Trim(gotdat.Delete(1,lng_pos));
}