G
Guest
I found the following way to convert from double[] to byte[] and I wonder if there is an easier one
And I have another question I can see from the value in canFloat if my Data can be stored in Float Data
If I want to do this and only convert 4 of the bytes in the double wich are the right ones? high or low
Thanks in Advanc
Marti
Guid FileName = Guid.NewGuid()
String SaveAs = "E:\\Stacks\\" + FileName.ToString()
File.SaveAs(SaveAs)
FileIO myIO = new Dickenbestimmung.FileIO()
int[] resolution
float[] length
resolution = new int[] {0,0,0,0}
length = new float[] {0,0,0,0 }
int canFloat = myIO.dbl_read(SaveAs,ref resolution,ref length)
int maxindex = resolution[0]*resolution[1]*resolution[2]*resolution[3]
byte[] ByteData = new byte[8*maxindex]
byte[] actDbl = new byte[8]
for (int i = 0; i<maxindex;i++
actDbl = BitConverter.GetBytes(myIO.data)
for (int p = 0; p<8;p++) ByteData[(8*i)+p]=actDbl[p]
object[] obj = new object[5];
obj[0] = ByteData
obj[1] = Name.Text
obj[2] = SaveAs
obj[3] = FileName
obj[4] = resolution[0]
SqlHelper.ExecuteNonQuery(connectionString,"sp_add_stack",obj);
And I have another question I can see from the value in canFloat if my Data can be stored in Float Data
If I want to do this and only convert 4 of the bytes in the double wich are the right ones? high or low
Thanks in Advanc
Marti
Guid FileName = Guid.NewGuid()
String SaveAs = "E:\\Stacks\\" + FileName.ToString()
File.SaveAs(SaveAs)
FileIO myIO = new Dickenbestimmung.FileIO()
int[] resolution
float[] length
resolution = new int[] {0,0,0,0}
length = new float[] {0,0,0,0 }
int canFloat = myIO.dbl_read(SaveAs,ref resolution,ref length)
int maxindex = resolution[0]*resolution[1]*resolution[2]*resolution[3]
byte[] ByteData = new byte[8*maxindex]
byte[] actDbl = new byte[8]
for (int i = 0; i<maxindex;i++
actDbl = BitConverter.GetBytes(myIO.data)
for (int p = 0; p<8;p++) ByteData[(8*i)+p]=actDbl[p]
object[] obj = new object[5];
obj[0] = ByteData
obj[1] = Name.Text
obj[2] = SaveAs
obj[3] = FileName
obj[4] = resolution[0]
SqlHelper.ExecuteNonQuery(connectionString,"sp_add_stack",obj);