AGB  ·  Datenschutz  ·  Impressum  







Anmelden
Nützliche Links
Registrieren
Thema durchsuchen
Ansicht
Themen-Optionen

Hilfe bei C++ Übersetzung

Ein Thema von Gehstock · begonnen am 23. Feb 2008 · letzter Beitrag vom 25. Feb 2008
 
Gehstock

Registriert seit: 28. Jan 2006
Ort: Görlitz / Sachsen
489 Beiträge
 
Delphi 2007 Professional
 
#3

Re: Hilfe bei C++ Übersetzung

  Alt 23. Feb 2008, 12:14
Dann wohl C++ nach Delphi


Delphi-Quellcode:
Function StringToCommbyte (Input : String ;length : DWORD; sendbytescom : Byte):Boolean; //oder Sendbytecom ist das result (byte)
var
 firsttrail : Boolean;
      count : DWord;
         sc : DWord;
          s : DWord;
        CRC : DWord; //DWORD crc
  sendbytes : Array [0..9999] of Byte; // byte sendbytes[10000] = {0};
Begin
   sc := 0; //DWORD sc=0;
   Stringreplace(Input,#20,'',[rfReplaceAll]);//input.Remove((char)0x20);
   length :=length div 2; //length=length/2;
   if Copy(Input,0,2) = #126 then //if (input.Mid(0,2)=="7E")
   begin
     firsttrail := True; //firsttrail=true;
   end;
   for Count := 0 to length do//for (DWORD count=0; count<length; count++)
      begin
        //sendbytes[count]=(byte)_strtoui64(input.Mid(count*2,2),NULL,16);
      end;
 // CRC := CalcCRC16(sendbytes,length,firsttrail);
// sendbytes[length]=(byte)(crc%0x100);
// sendbytes[++length]=(byte)(crc/0x100);

for s := 0 to length + 1 do // for (DWORD s=0;s<length+1;s++)
   begin
      Case sendbytes[s] of // {Case of} switch ((byte)sendbytes[s])
    $7e: Begin //case 0x7e:
           if SC = 0 Then// if (sc!=0)
            Begin
              sendbytescom[sc] := $7D; //sendbytescom[sc]=(byte)0x7D;
              sendbytescom[inc(sc)] := $5e; //sendbytescom[++sc]=(byte)0x5E;
            end else
              sendbytescom[sc] := sendbytes[s]; //sendbytescom[sc]=sendbytes[s];
            break;
            end;
    $7d: Begin //case 0x7D:
           sendbytescom[sc] := $7D; //sendbytescom[sc]=(byte)0x7D;
           sendbytescom[inc(sc)] := $5D; // sendbytescom[++sc]=(byte)0x5D;
           break;
            end;
         else
           sendbytescom[sc] := sendbytes[s]; //sendbytescom[sc]=sendbytes[s];
            break;
      end;
   Inc(sc);
   end;
   length := sc;
end;
so in etwa hab ichs bis jetzt
Marcel
  Mit Zitat antworten Zitat
 


Forumregeln

Es ist dir nicht erlaubt, neue Themen zu verfassen.
Es ist dir nicht erlaubt, auf Beiträge zu antworten.
Es ist dir nicht erlaubt, Anhänge hochzuladen.
Es ist dir nicht erlaubt, deine Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks are an
Pingbacks are an
Refbacks are aus

Gehe zu:

Impressum · AGB · Datenschutz · Nach oben
Alle Zeitangaben in WEZ +1. Es ist jetzt 10:00 Uhr.
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024-2025 by Thomas Breitkreuz