Click here to Skip to main content
15,894,284 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Could somebody please help me to convert the following function into C#

C++
function TAclasencode.BufToDataBIN(const Buf: TByteDynArray; iStartPos,
  iLen, iDec: Integer): Variant;
const
  DefaultLen = 8;
var
  i : Integer;
  iTmp   : Int64;
  arr    : array[0..7]of Byte;
  pInt64 : ^Int64;
  fTmp   : Double;
begin
   fTmp  := 0;
   try
       FillChar(arr,8,0);
       if (Buf[iStartPos] and $80=$80) and (not IsCardinal) then
       begin                                                                 
           if Negative then
           begin
              for I:=0 to iLen-2 do arr[I]:=(Buf[iStartPos+iLen-1-I] xor $FF);
              pInt64:=@arr[0];
              iTmp:=pInt64^+1;
           end else
           begin
              for I:=0 to iLen-2 do arr[I]:=(Buf[iStartPos+iLen-1-I]);
              pInt64:=@arr[0];
              iTmp:=pInt64^;
           end;
           fTmp:=iTmp;
           fTmp:=fTmp/Power(10,iDec);
           fTmp:=0-fTmp;
       end else
       begin
           for I:=0 to iLen-1 do arr[I]:=(Buf[iStartPos+iLen-1-I]);
           pInt64:=@arr[0];
           iTmp:=pInt64^;
           fTmp:=iTmp;
           fTmp:=fTmp/Power(10,iDec);
       end;
   finally
       Result := fTmp;
   end;
end;


Thanks

[edit]Code block added - OriginalGriff[/edit]
Posted
Updated 23-Apr-12 21:06pm
v2
Comments
coert dorrepaal 24-Apr-12 7:55am    
Thanks for the advice. Will Do.

1 solution

You may get a quicker response if you post it in the Delphi forum[^]. Don't forget to delete this question after reposting.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900