float array to byte array

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Cory Autry

    #1

    float array to byte array

    What is the best way to convert a array of floats to a byte array, or at
    least have the ADO dataset assignment operator see the array as a byte
    array.

    Thanks,
    Jim


  • Austin Ehlers

    #2
    Re: float array to byte array

    /*untestede code*/

    int len=floatarray. Length;
    byte[] bytes=new byte[len];
    int x=0;
    foreach(float f in floatarray)
    {
    byte[] t=BitConverter. GetBytes(f);
    for(int y=0;y<4);y++)
    bytes[y+x]=t[y];
    x+=4;
    }

    That *should* compile.

    Austin Ehlers
    On Sun, 12 Oct 2003 22:22:16 GMT, "Cory Autry"
    <c.a.autry@eart hlink.net> wrote:
    [color=blue]
    >What is the best way to convert a array of floats to a byte array, or at
    >least have the ADO dataset assignment operator see the array as a byte
    >array.
    >
    >Thanks,
    >Jim
    >[/color]

    Comment

    Working...