I have this C# code where I want to pass a byte array of 256 bytes into a struct to be passed into a Delphi DLL.

I have this C# code where I want to pass a byte array of 256 bytes into a struct to be passed into a Delphi DLL.  

    TWLInputRec.OutputFileName = new byte[256];
    TWLInputRec.OutputFileName = Encoding.ASCII.GetBytes("report.pdf\0");

Hower, it seems the first statement is not necessary, as the second statement will   allocate bytes  in the call to GetBytes, but it will only allocate 11 bytes.   How can I get the OutputFileName to always get 256 bytes (as that's what the Delphi DLL is expecting)?

Comments