lisp2arx
Visual Programming for AutoLisp Mathématiques en programmation Lisp.. doc2cpp,doc2lsp, sld2lsp, bmp2dcl, free__GifCcapture for all-CAD'platforms..
Lista Forumurilor Pe Tematici
lisp2arx | Reguli | Inregistrare | Login

POZE LISP2ARX

Nu sunteti logat.
Nou pe simpatie:
Iasminica
Femeie
24 ani
Arad
cauta Barbat
24 - 52 ani
lisp2arx / Delphi , InnoPascal / Delphi32 - Hidden zero to String for 100%sure  
Autor
Mesaj Pagini: 1
admin
Administrator

Din: Bucharest
Inregistrat: acum 13 ani
Postari: 508
When, You convert cString to Pchar , the old-routines (Delphi7,Delphi3)
fail skip the last zero pchar(String);?>
//Fix1=You search  ??? to test RTFail
//Fix2=You replace pchar(...) with  str_2pchar(...)

Code:

Const con_zero3=#00#00#00;
Var romania:string='';;
Function str_pas2(arrayeditstate:pchar;limcheck:integer):string;
Var nth:integer;
Begin
    result:='';
    if (arrayeditstate=nil) or (arrayeditstate^=#0) then exit;
    if (limcheck<1) then limcheck:=strlen(arrayeditstate);
    SetString(result,arrayeditstate,limcheck);
    result:=concat(result,#0#0#0);
    SetLength(result,limcheck);
End;

Function str_2pchar255(var s133: shortstring; RtlZeroMemory: shortint): pchar;
Var
  dimexe:integer;
Begin { ..$VARSTRINGCHECKS OFF }
  dimexe := length(s133);
  if (dimexe < 1) then
  begin
    s133 := concat(s133, '123');
    s133[3] := #0;
    s133[2] := #0;
    s133[1] := #0;
    Result := @s133[1];
    exit;
  end;
  dimcen := length(s133);
  s133 := concat(s133, con_zero3);
  setlength(s133, dimexe);
  Result := @s133[1];
  { ..$VARSTRINGCHECKS ON }
End;

Code:

Function str_2pchar(var s133: string): pchar;
Var
  dimexe:integer;
Begin { ..$VARSTRINGCHECKS OFF }
  dimexe := length(s133);
  if (dimexe < 1) then
  begin
    s133 := concat(s133, '123');
    s133[3] := #0;
    s133[2] := #0;
    s133[1] := #0;
    Result := @s133[1];
    exit;
  end;
  dimcen := length(s133);
  s133 := concat(s133, con_zero3);
  setlength(s133, dimexe);
  if (length(s133)>dimexe) then 
     romania:='You failed resize , ??? you must set breakPoint here';l
  Result := @s133[1];
  { ..$VARSTRINGCHECKS ON }
End;



delphi32 hidden zero string for 100%sure when, you convert cstring pchar the fail skip the last zero

25KB


_______________________________________


pus acum 2 ani
   
Pagini: 1  

Mergi la