конвертировать в Delphi (object pascal)...

Discussion in 'С/С++, C#, Rust, Swift, Go, Java, Perl, Ruby' started by HakaR, 14 Aug 2010.

  1. HakaR

    HakaR Active Member

    Joined:
    23 Jul 2009
    Messages:
    301
    Likes Received:
    200
    Reputations:
    3
    Всем привет.
    У меня тут проблемка, нужно конвертировать чуть-чуть кода из cи\c++\c# в делфи, может кто помочь?
    Си
    PHP:
    struct
    {
        
    RiffChunk       chunk           __PACKED;
        
    unsigned short    wFormatTag      __PACKED
        
    unsigned short    nChannels       __PACKED;  
        
    unsigned int    nSamplesPerSec  __PACKED;   
        
    unsigned int    nAvgBytesPerSec __PACKED;   
        
    unsigned short    nBlockAlign     __PACKED;   
        
    unsigned short    wBitsPerSample  __PACKED;    
    }

    struct
    {
        
    RiffChunk   chunk;
    DataChunk = { {{'d','a','t','a'}, lenbytes } };
    Cи++
    Тоже самое что и просто Си :)

    С#
    PHP:
    [StructLayout(LayoutKind.SequentialPack 1)]
    struct FmtChunk
    {
        public 
    RiffChunk    chunk;
        public 
    ushort        wFormatTag;
        public 
    ushort        nChannels;
        public 
    uint            nSamplesPerSec
        public 
    uint            nAvgBytesPerSec;  
        public 
    ushort        nBlockAlign;
        public 
    ushort        wBitsPerSample;
    }

    [
    StructLayout(LayoutKind.SequentialPack 1)]
    struct DataChunk
    {
        public 
    RiffChunk   chunk;
    }
    Заранее спасибо!
     
  2. Redeemer

    Redeemer Member

    Joined:
    3 Jul 2010
    Messages:
    203
    Likes Received:
    24
    Reputations:
    1
    Code:
    FmtChunk = packed record
      chunk: RiffChunk; 
      wFormatTag: WORD; 
      nChannels: WORD; 
      nSamplesPerSec: DWORD;  
      nAvgBytesPerSec: DWORD;   
      nBlockAlign: WORD; 
      wBitsPerSample: WORD; 
    end;
     
    1 person likes this.
Loading...