User Profile

Collapse

Profile Sidebar

Collapse
ulmus
ulmus
Joined: May 23 '13
Location:
  •  
  • Time
  • Show
  • Source
Clear All
new posts

  • ulmus
    replied to Struct from C to C#
    Finally i did this, it is not as fast as union but does what it should do :
    Code:
        public struct Wynik
        {
            public Byte[] Bytes;
            //////////////////////////////////////
            public Int32 Value          { get { return BitConverter.ToInt32(Bytes, 0); } set { BitConverter.GetBytes(value).CopyTo(Bytes, 0); } }
            public Int32 ValueFromADC   { get { return BitConverter.ToInt32(Bytes, 4);
    ...
    See more | Go to post

    Leave a comment:


  • ulmus
    started a topic Struct from C to C#

    Struct from C to C#

    I receive data from usb in specific record structure (cant change it). I have method to read buffer to Byte[]. Simple struct union would do the job but c# is broken in that case.
    My struct in C is:

    Code:
    typedef union
    {
    	struct
    	{
    		int Value;
    		int ValueFromADC;
    		int Zero;
    		int Temperature;
    		int RefTemperature;
    
    		unsigned char Metal;
    		unsigned char Range;
    ...
    See more | Go to post
    Last edited by acoder; May 23 '13, 11:52 AM. Reason: Please use [code] tags when posting code
No activity results to display
Show More
Working...