Click here to Skip to main content
15,905,420 members
Home / Discussions / C#
   

C#

 
GeneralRe: same code in menus and button Pin
WujekSamoZlo8-May-05 4:36
WujekSamoZlo8-May-05 4:36 
GeneralRe: same code in menus and button Pin
DavidNohejl8-May-05 5:41
DavidNohejl8-May-05 5:41 
Generalusb interfacing in c#.Net(framework 1.1) Pin
ahsan1418-May-05 1:45
ahsan1418-May-05 1:45 
Generalreading binary files Pin
Crazy Joe Devola8-May-05 1:11
Crazy Joe Devola8-May-05 1:11 
GeneralRe: reading binary files Pin
Polis Pilavas8-May-05 1:40
Polis Pilavas8-May-05 1:40 
GeneralRe: reading binary files Pin
Crazy Joe Devola8-May-05 2:04
Crazy Joe Devola8-May-05 2:04 
GeneralRe: reading binary files Pin
Polis Pilavas8-May-05 2:10
Polis Pilavas8-May-05 2:10 
GeneralRe: reading binary files Pin
Crazy Joe Devola10-May-05 14:33
Crazy Joe Devola10-May-05 14:33 
Thanks, but I am not sure that's what I need.
In C++, my structure looks as follows:

struct sample_
{
unsigned short f1;
long f2;
unsigned char filler[1000];
}; // total 1006

I declared it in C# as follows:

[StructLayout(LayoutKind.Sequential, CharSet=CharSet.Ansi, Pack=1)]
public class sample_
{
public ushort f1;
public int f2;
public byte[] arr=new byte[1000];
}

But it's not good because the size should 1006, and it is actually 10 (2+4+4).
sample_ mySample = new sample_();

Console.WriteLine ("sizeof={0}", Marshal.SizeOf(mySample));

Is there a way I can declare the array without new? Or do I have to declare 1000 byte fillers?

GeneralRe: reading binary files Pin
Dave Kreskowiak8-May-05 2:54
mveDave Kreskowiak8-May-05 2:54 
GeneralRe: reading binary files Pin
suceny14-Nov-09 22:37
suceny14-Nov-09 22:37 
GeneralRe: reading binary files Pin
Dave Kreskowiak15-Nov-09 10:51
mveDave Kreskowiak15-Nov-09 10:51 
QuestionInstaller and uninstaller? Pin
WujekSamoZlo8-May-05 0:24
WujekSamoZlo8-May-05 0:24 
AnswerRe: Installer and uninstaller? Pin
Colin Angus Mackay8-May-05 0:36
Colin Angus Mackay8-May-05 0:36 
GeneralRe: Installer and uninstaller? Pin
WujekSamoZlo8-May-05 4:39
WujekSamoZlo8-May-05 4:39 
GeneralRe: Installer and uninstaller? Pin
ChesterPoindexter8-May-05 4:51
professionalChesterPoindexter8-May-05 4:51 
GeneralRe: Installer and uninstaller? Pin
WujekSamoZlo8-May-05 5:52
WujekSamoZlo8-May-05 5:52 
GeneralRe: Installer and uninstaller? Pin
WujekSamoZlo8-May-05 6:17
WujekSamoZlo8-May-05 6:17 
GeneralConversion Pin
Member 19080777-May-05 19:54
Member 19080777-May-05 19:54 
GeneralRe: Conversion Pin
Colin Angus Mackay8-May-05 0:34
Colin Angus Mackay8-May-05 0:34 
GeneralRe: Conversion Pin
Colin Angus Mackay9-May-05 1:05
Colin Angus Mackay9-May-05 1:05 
GeneralPrintScreen and saving to an Image object Pin
WujekSamoZlo7-May-05 11:00
WujekSamoZlo7-May-05 11:00 
GeneralRe: PrintScreen and saving to an Image object Pin
Polis Pilavas7-May-05 14:07
Polis Pilavas7-May-05 14:07 
GeneralRe: PrintScreen and saving to an Image object Pin
WujekSamoZlo7-May-05 23:36
WujekSamoZlo7-May-05 23:36 
GeneralRe: PrintScreen and saving to an Image object Pin
Polis Pilavas8-May-05 1:33
Polis Pilavas8-May-05 1:33 
GeneralRounding off integers Pin
katiebrennan7-May-05 10:16
katiebrennan7-May-05 10:16 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.