Questions tagged [byte]

A unit of information usually corresponding to 8 bits. This term is also most often used to indicate the smallest addressable unit of storage on a digital system.

A unit of information usually corresponding to 8 bits. This term is also most often used to indicate the smallest addressable unit of storage on a digital system.

These days, the term byte usually refers to a unit of information consisting of 8 . Historically, other sizes have been used as well. If one wants to stress the fixed size, the term octet can be used instead.

7742 questions
2
votes
4 answers

How to declare and set value for a bit variable in C#?

I'm buiding a streaming video server in Windows Media Http Streaming Protocol (WMSP) with C#. I've read WMSP Specification. In Framing Header of packets as $H, $D... has 2 fields : B (1 bit): A 1-bit flag. This flag SHOULD be set to 1 if the next…
PenguinSh
  • 129
  • 2
  • 4
  • 12
2
votes
1 answer

Uploading to Dropbox but tiny file size

I have a VBA function in Excel which creates a document.docx and then uploads it to Dropbox. It is successfully creating a file in Dropbox, but it can't be opened because it is only 2 bytes in size. Why is there no content in this file? I don't…
Brad
  • 1,019
  • 1
  • 9
  • 22
2
votes
2 answers

How do I write a byte [] into an Excel file?

I am very new to c# although i control all the basics. I essentially have a byte [] for the y-axis of an accelerometer (up/down) which I called Y[]. I need one line of code to export this to an excel file (I work with Office professional 2003). I…
new to c sharp
  • 43
  • 1
  • 1
  • 6
2
votes
1 answer

golang byte and string Sometimes compatible and sometimes incompatible

This is my golang code package test import ( "fmt" "testing" ) func TestOne(t *testing.T) { bytes := make([]byte, 0) bytes = append(bytes, 1, 2, 3) // pass bytes = append(bytes, []byte{1, 2, 3}...) // pass …
Linuxea
  • 319
  • 1
  • 4
  • 15
2
votes
0 answers

Reading Bytes in Python from Bluetooth, encode problem

I'm trying to get some values from bluetooth in Python, my problem basically is when I tried to read the data from bluetooth, in this two lines: value = bytes(await connection.client.read_gatt_char(read_characteristic)) print(value) it…
user16239103
2
votes
1 answer

how to convert string of bytes string into string using python

I got a string of bytes string like below: string1 = "b'\xe6\x88\x91\xe4\xbb\xac \xe7\xb4\xa2\xe8\xa6\x81 \xe6\x8e\xa8\xe5\xb9\xbf \xe7\x9a\x84 \xe6\x98\xaf\xe4\xb8\x80 \xe5\xbe\x97 \xe6\x96\xb9\xe6\x96\xb9 \xe6\x96\xb9\xe8\xa8\x80…
Peter Tsung
  • 915
  • 2
  • 10
  • 20
2
votes
1 answer

How to utilize every bit of a bytearray in python

I have a bytearray like this: a=bytearray([False]*size) I want to store the False value not as a byte but a bit in the byte array; I care about the memory. Is there anyway I can do that? As using 8 bits to store 1 bit value seems like a waste. Also…
alex ale
  • 31
  • 5
2
votes
3 answers

set some consecutive bits in a byte

I need an efficient method with the following signature: public byte SetBits(byte oldValue, byte newValue, int startBit, int bitCount) Which returns oldValue, only that starting from its startbit bit up to its startbit + bitcount bit (zero-based),…
Ohad Schneider
  • 36,600
  • 15
  • 168
  • 198
2
votes
1 answer

How do I get the size of an image represented as a Unit8Array?

I have an array of bytes of the user's avatar picture. It represented as typed Unit8Array() const imageBytes = new Unit8Array(...); Now I need to check the image size for setting some limitations to prevent the user from putting massive images, but…
user15307601
2
votes
4 answers

Bitmask for exactly one byte in C

My goal is to save a long in four bytes like this: unsigned char bytes[4]; unsigned long n = 123; bytes[0] = (n >> 24) & 0xFF; bytes[1] = (n >> 16) & 0xFF; bytes[2] = (n >> 8) & 0xFF; bytes[3] = n & 0xFF; But I want the code to be portable, so I…
Andy Sukowski-Bang
  • 1,402
  • 7
  • 20
2
votes
1 answer

Can I create a variable with only one bit in the c programming language?

I am new in C. And I wonder can I create a variable with only one bit in the c programming language? or a variable with three bits. For example : variable_type var1=0; /* 1 bit */ printf("%d",sizeof(var1)); /* output= 0.125 */ variable_type…
user15509107
2
votes
1 answer

Change byte array buffer with python

I have bytes array in Python that I want to change some value by index arr =b'12345678' arr[2:] =b'fff' But I got error TypeError: 'bytes' object does not support item assignment Why is that ? how to do that ?
MicrosoctCprog
  • 460
  • 1
  • 3
  • 23
2
votes
1 answer

Python convert string to bytes

Bear with me here guys, i am very begginer in Python. I would like to convert a string to bytes, actually doing it without any problem but having a problem on length of converted byte data. Here is my string and its lenght is 36: mystring =…
fenderogi
  • 118
  • 7
2
votes
2 answers

How / Where can I learn what's happening "under the hood" in Python

I am currently mainly developing things in Python, I code in Python a lot, and I am slowly starting to wonder: "what really happens on the lower-level of Python?", I know that Python's code gets converted to binary code which then gets processed,…
Lotus
  • 119
  • 2
  • 8
2
votes
2 answers

lua parsing after more than one byte

how can I parse an binary after more than one byte? for example: 56 30 30 31 07 00 00 00 EF BF BD EF BF BD 2A 5C EF BF BD 03 01 45 7E 12 02 EF BF BD 00 EF BF BD 1F 56 30 30 31 01 00 00 00 EF BF BD EF BF BD 2A 5C EF BF BD 03 02 45 24 56 30 30 31 04…
Glupschi
  • 215
  • 1
  • 9