473,399 Members | 3,832 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,399 software developers and data experts.

How to Convert bytes[] to double?

I can't convert it correctly by Convert class.

for example:

I got a bufferStream, and

byte[] a = {0,0,0,0,0,10,1,23}

I want to convert a to double b. How should I do?

Aug 5 '07 #1
3 14046
佳宏 wrote:
I can't convert it correctly by Convert class.

for example:

I got a bufferStream, and

byte[] a = {0,0,0,0,0,10,1,23}

I want to convert a to double b. How should I do?
BitConverter.ToDouble maybe.

Arne
Aug 5 '07 #2
=?big5?B?qM6nuw==?= <ts******@gmail.comwrote:
I can't convert it correctly by Convert class.

for example:

I got a bufferStream, and

byte[] a = {0,0,0,0,0,10,1,23}

I want to convert a to double b. How should I do?
Well, how was it encoded in the first place? We can't possibly answer
without knowing what the format is meant to be.

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet Blog: http://www.msmvps.com/jon.skeet
If replying to the group, please do not mail me too
Aug 5 '07 #3
On 8 6 , 5 31 , Arne Vajhj <a...@vajhoej.dkwrote:
wrote:
I can't convert it correctly by Convert class.
for example:
I got a bufferStream, and
byte[] a = {0,0,0,0,0,10,1,23}
I want to convert a to double b. How should I do?

BitConverter.ToDouble maybe.

Arne
Thank you Arne, you method can work~

Aug 6 '07 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: hunterb | last post by:
I have a file which has no BOM and contains mostly single byte chars. There are numerous double byte chars (Japanese) which appear throughout. I need to take the resulting Unicode and store it in a...
7
by: jose luis fernandez diaz | last post by:
Hi, The program below prints a unsigned short in binary base: #include <iostream> int main() { unsigned short mask =0x1; unsigned short us =0x0071;
12
by: DanSteph | last post by:
hello all, I have a problem, I have a DOUBLE value like that 4065 4000 0000 0000 and I want to convert it to a DWORD like that: 4065 4000 if I do result=(DWORD)MyDouble it end with...
16
by: Khuong Dinh Pham | last post by:
I have the contents of an image of type std::string. How can I make a CxImage object with this type. The parameters to CxImage is: CxImage(byte* data, DWORD size) Thx in advance
5
by: kevinniu | last post by:
Hi everyone, In c#, what is the fastest way(include unsafe) to convert a array of bytes(which really contains the bytes of a double array) to a arry of double. thanks
2
by: antonio matos | last post by:
hi people. I have to acess a database, and there are some fields that are binary. when i acess that field is read like an array of bytes. but in reality it's an array of doubles!!! how can...
17
by: David Scemama | last post by:
Hi, I'm writing a program using VB.NET that needs to communicate with a DOS Pascal program than cannot be modified. The communication channel is through some file databases, and I have a huge...
10
by: Nikolay Petrov | last post by:
How can I convert DOS cyrillic text to Unicode
5
by: yekasi | last post by:
Hi, I have this number, 1.5283632704970307 in char*, and I need to convert it to a double type in C++ that is capable of storing that number of precisions.... I tried doing atof and storing it...
1
by: =?big5?B?qM6nuw==?= | last post by:
I already knew how to convert bytes to Double, use BitConverter.ToDouble(). but, How to convert double to bytes? for example: double a = 3,444; I want convert to bytes={ ?, ?, ?, ?, ?, ?,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development projectplanning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.