bitconverter Questions

8

Solved

I need to check for a string located inside a packet that I receive as byte array. If I use BitConverter.ToString(), I get the bytes as string with dashes (f.e.: 00-50-25-40-A5-FF). I tried most fu...
Refresher asked 7/4, 2009 at 9:45

5

Solved

In our application, we have a very large byte-array and we have to convert these bytes into different types. Currently, we use BitConverter.ToXXXX() for this purpose. Our heavy hitters are, ToInt16...
Concurrence asked 7/2, 2011 at 16:41

9

Solved

I have a generic class which saves value for the specified type T. The value can be an int, uint, double or float. Now I want to get the bytes of the value to encode it into an specific protocol. T...
Raisaraise asked 11/4, 2013 at 21:4

8

Solved

If I have an Uint8Array array in JavaScript, how would I get the last four bytes and then convert that to an int? Using C# I would do something like this: int count = BitConverter.ToInt32(array, a...
Depreciatory asked 19/2, 2013 at 17:1

6

Solved

I've found that the implementation of the GetBytes function in .net framework is something like: public unsafe static byte[] GetBytes(int value) { byte[] bytes = new byte[4]; fixed(byte* b = byt...
Gentoo asked 30/12, 2011 at 1:18

3

Solved

I am trying to cast a float into a byte array of length 4, and then back again. But I it doesn's seems to work. Here's what I've done: byte[] b = BitConverter.GetBytes(90); float fb = BitConverte...
Sackman asked 26/8, 2019 at 13:50

11

Solved

I would like to be able to convert a high-valued unsigned-integer (a value that uses the highest-order bit) to a signed-integer. In this case, I don't care that the value is higher than the maximum...
Phallus asked 5/2, 2013 at 13:34

2

Solved

I am collecting data from a USB device and this data has to go to an audio output component. At the moment I am not delivering the data fast enough to avoid clicks in the output signal. So every mi...
Urrutia asked 22/10, 2018 at 2:57

5

Solved

Is there any function to convert binary string into binary or decimal value? If I have a binary string 000101, what should I do to convert it into 5?
Liquefy asked 15/10, 2012 at 9:4

1

Solved

I am triyng to convert byte array into an int value however I am getting an exception: "Destination array is not long enough to copy all the items in the collection. Check array index and lengt...
Deuteron asked 31/12, 2015 at 14:11

1

Solved

I wrote my own class which converts C# standard primitives into byte arrays. Later on, I took a look at the BitConverter class source, to see how pros did it. My code example: public static byt...
Pressurecook asked 15/8, 2015 at 11:17

2

Solved

Hello I am using digi dynamic c. I am trying to convert this in to string char readingreg[4]; readingreg[0] = 4a; readingreg[1] = aa; readingreg[2] = aa; readingreg[3] = a0; Currently when I do ...
Baumann asked 2/9, 2014 at 19:30

7

Solved

I was so happy when I discovered IsLittleEndian field in BitConverter. I thought of course it should be there and I should be able to specify whatever endian I like. Well, my happiness didn’t last ...
Everywhere asked 20/6, 2011 at 3:28

2

Solved

I am developing a portable class library in C# and I want to bit convert a double to a long. The most straightforward solution to this issue would be to use the BitConverter.DoubleToInt64Bits metho...
Peneus asked 9/5, 2012 at 13:26

5

Solved

I received the contents of a text file returned in binary values: Byte[] buf = new Byte[size]; stream = File.InputStream; stream.Read(buf, 0, size); How can I convert this to ASCII?
Weightless asked 2/7, 2011 at 3:6

1

How would I convert this into a loop and not to use the pointer. byte[] InputBuffer = new byte[8]; unsafe { fixed (byte* pInputBuffer = InputBuffer) { ((long*)pInputBuffer)[0] = value; } } I ...
Wellmannered asked 3/2, 2011 at 3:26
1

© 2022 - 2024 — McMap. All rights reserved.