Delphi-PRAXiS

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   Programmieren allgemein (https://www.delphipraxis.net/40-programmieren-allgemein/)
-   -   c++ Variablen in Delphi (https://www.delphipraxis.net/109170-c-variablen-delphi.html)

Gehstock 25. Feb 2008 16:23


c++ Variablen in Delphi
 
gesucht werden

byte* buf_ptr, DWORD& list, ^byte und DWORD *table, unsigned char *buffer,

Dax 25. Feb 2008 16:26

Re: c++ Variablen in Delphi
 
byte* buf_ptr -> buf_ptr: PByte

DWORD& list -> var list: Cardinal

^byte -> sagt mir leider nix ;)

DWORD *table -> table: PCardinal

unsigned char *buffer -> gibts so direkt nicht, am ehesten buffer: PChar

Gehstock 25. Feb 2008 16:36

Re: c++ Variablen in Delphi
 
bei einem typ hab ich ein problem

DWORD *table


Delphi-Quellcode:
void CAMSSAnalyzerDlg::make_crc30_table(DWORD *table)
{
    DWORD c;
    int n, k;
       
    for (n = 0; n < 256; n++) {
        c = n;
      c <<= (30-8);
        for (k = 0; k < 8; k++) {
            if ((c & 1<<(30-1)) != 0) {
                c = CRC_30_POLYNOMIAL ^ (c << 1);
            } else {
                c <<= 1;
            }
        }
        table[n] = c;
    }
}
hab ich zu übersetzt(Versuch)

Delphi-Quellcode:
Procedure make_crc30_table(table: PCardinal);
var
c : DWord;
n,k : Integer;
begin
    for n := 0 to 255 do
    begin
     c := n;
      c := c shl (30-8);
        for k := 0 to 7 do
         begin
            if not((c and 1 shl (30-1)) = 0) then
                c := CRC_30_POLYNOMIAL xor (c shl 1)
             else
                c := c shl 1;
        end;
        table[n] := c;      //Fehler
    end;
end;
Zitat:

Array type Required

Dax 25. Feb 2008 16:40

Re: c++ Variablen in Delphi
 
Jop, DWORD *table lässt sich mit table: PCardinal oder table: array of Cardinal übersetzen.

Gehstock 25. Feb 2008 16:42

Re: c++ Variablen in Delphi
 
Danke so gibt es keine Fehler ist die Übersetzung soweit richtig?

Dax 25. Feb 2008 16:48

Re: c++ Variablen in Delphi
 
Delphi-Quellcode:
if not((c and 1 shl (30-1)) = 0) then
sollte besser ein
Delphi-Quellcode:
if (c and (1 shl (30-1)) <> 0 then
sein...

edit: ups, verklammert


Alle Zeitangaben in WEZ +1. Es ist jetzt 10:15 Uhr.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz