uint8t Questions

3

Solved

Now we all sometimes have to work with binary data. In C++ we work with sequences of bytes, and since the beginning char was the our building block. Defined to have sizeof of 1, it is the byte. And...
Alter asked 28/4, 2013 at 5:46

5

Solved

I'm trying to convert a []uint8 byte slice into a float64 in GoLang. I can't find a solution for this issue online. I've seen suggestions of converting to a string first and then to a float64 but t...
Bibliopole asked 18/3, 2014 at 21:57

9

Solved

I wrote a simple program that sets a value to a variable and then prints it, but it is not working as expected. My program has only two lines of code: uint8_t a = 5; cout << "value is &...
Tardigrade asked 24/10, 2013 at 9:30

1

I'm coding in C and I know the values that can be stored in a uint8_t range from 0 to 255. I want to store a value that is the percentage of MAX_INTENSITY, declared as: #define MAX_INTENSITY 200 Ca...
Ogburn asked 25/2, 2022 at 9:33

2

Solved

I have an array of type uint8_t. I want to create a string that concatenates each element of the array. Here is my attempt using an ostringstream, but the string seems to be empty afterward. std::...
Nason asked 28/3, 2015 at 17:41

4

Solved

I have got a float variable that I need to send through a CAN protocol. To do so, this float of 32 bits must be cut in 4 uint8_t variables. I have absolutely no idea of how to do. I was first thin...
Decahedron asked 19/8, 2014 at 14:48

1

Solved

I was a bit messing around with uint8_t and was curious what happens when I outflow bits to the left and found that uint8_t i = 234; uint8_t j = (i << 1); auto k = (i << 1); s...
Serieswound asked 22/8, 2019 at 12:22

3

I am new to the C-Headers - stdint.h and inttypes.h. I was trying out some code to get an inkling of how uint8_t works. But, it seems to have encountered a problem. I have declared 4 uint8_t integ...
Suggest asked 9/5, 2019 at 8:25

3

Solved

I am an Embedded Software developer and I want to interface to an external device. This device sends data via SPI. The structure of that data is predefined from the external device manufacturer and...
Bicollateral asked 8/11, 2018 at 8:33

1

Solved

I have a program that uses dynamic allocation for a uint8_t array; can I safely assume that its length will always be one byte?
Gatekeeper asked 7/2, 2018 at 3:3

2

Solved

I am programming in C using Atmel Studio (for those unfamiliar with this it is used to program to micro controllers such as arduino. You can not simply print, you have to send the data Serially to ...
Jaramillo asked 22/3, 2017 at 19:54

3

Solved

I have a pointer to a vector of type uint8. How would I take this pointer and convert the data in the vector into a full string representative of its content?
Preconception asked 31/7, 2013 at 23:28

3

Solved

I have a server-client application that I'm working on that basically simulates a chat room. This is an assignment for school and the protocol specifications are somewhat strict. I have a char ar...
Punkie asked 13/11, 2016 at 23:19

1

Solved

I would like to pass as argument of a function in my C module an array of uint8_t's. I couldn't find a method to directly parse this array, so I'm parsing it to a PyObject_t and then iterating as...
Armilla asked 26/4, 2016 at 15:51

4

Solved

I would like to statically initialize huge (megabytes) uint8_t array. At the beginning I tried this: constexpr uint8_t arr[HUGE_SIZE] = { 0, 255, ... }; Unfortunatelly, compilation time of above...
Eldwun asked 28/12, 2015 at 11:25

4

Solved

I'm trying to determine array length of msg on the below code. I used strlen and sizeof but they don't return 6. What function can I use to determine the length of uint8_t array or how can I modify...
Inclose asked 16/4, 2015 at 11:17

4

In this answer and the attached comments, Pavel Minaev makes the following argument that, in C, the only types to which uint8_t can be typedef'd are char and unsigned char. I'm looking at this draf...
Predominant asked 30/9, 2012 at 23:53

4

Solved

I transfer message trough a CAN protocol. To do so, the CAN message needs data of uint8_t type. So I need to convert my char* to uint8_t. With my research on this site, I produce this code : cha...
Asberry asked 18/8, 2014 at 10:13

5

Solved

A tiny piece of code drives me crazy but hopefully you can prevent me from jumping out of the window. Look here: #include <iostream> #include <cstdint> int main() { int8_t i = ...
Tundra asked 7/7, 2014 at 18:59

1

In my code I have an object that contains a series of pixel coordinates. Performance of this object is critical because it's being used in a 60fps game where the output cannot always be cached. A...
Hostess asked 1/6, 2014 at 10:30

8

Solved

What is the advantage of using uint8_t over unsigned char in C? I know that on almost every system uint8_t is just a typedef for unsigned char, so why use it?
Crumby asked 12/11, 2009 at 22:28

2

Solved

I'm writing a Dart library in which I'm very regularly dealing with byte arrays or byte strings. Since Dart doesn't have a byte type nor an array type, I'm using List for all byte arrays. Is this ...
Hallel asked 11/11, 2013 at 2:13

1

Solved

is it a correct way to convert an int value to uint8_t: int x = 3; uint8_t y = (uint8_t) x; assume that x will never be less than 0. Although gcc does not give any warning for the above lines,...
Gant asked 26/7, 2013 at 13:21

1

Solved

$ file testfile.txt testfile.txt: ASCII text $ cat testfile.txt aaaabbbbccddef #include <iostream> #include <fstream> #include <string> #include <cstdint> typedef u...
Funny asked 26/7, 2013 at 6:9

3

Solved

According to C and C++, CHAR_BIT >= 8. But whenever CHAR_BIT > 8, uint8_t can't even be represented as 8 bits. It must be larger, because CHAR_BIT is the minimum number of bits for any data t...
Alpenglow asked 22/4, 2013 at 1:45

© 2022 - 2024 — McMap. All rights reserved.