Questions tagged [unsigned-char]

321 questions
2
votes
1 answer

uint8 little endian array to uint16 big endian

In Python2.7, from an USB bulk transfer I get an image frame from a camera: frame = dev.read(0x81, 0x2B6B0, 1000) I know that one frame is 342x260 = 88920 pixels little endian, because that I read 2x88920 = 177840 (0x2B6B0) from the bulk…
Paul G.
  • 461
  • 6
  • 21
2
votes
1 answer

Reading newline-separated items from file

I've a problem with my .c program. I'll explain it : I have 2 files (listePassword.txt and system_1.phl) First file contains 10 passwords (like 123456, 12345678, admin, etc) The second contains 10 hashs (f31041d6d9c2031086bfe561d8e4b63f or…
user9772676
2
votes
3 answers

How to calculates the average of elements in an unsigned char array?

I've got a quick and I am assuming question but I have not been able to find anything online. How to calculates the average of elements in an unsigned char array? Or more like it, perform operations on an unsigned char?
Everton
  • 109
  • 2
  • 9
2
votes
1 answer

Unsigned char goes from f0 to 00 when incremented by 16

I am currently writing a program in C. I have a variable i declared in my program. I have initialized it as such: unsigned char i = 0x00; Next, I have a while loop, and inside that while loop, I'm increasing the unsigned char by 16 and displaying…
2
votes
1 answer

swig c++ to python return unsigned char* by reference

I'm using swig to wrap a c++ function to python like this: int getBytes(unsigned char *& result, int length) I have learnt from this question how to wrap a function returned char* by reference: %typemap(in,numinputs=0) char*& (char* tmp) %{ $1…
IvyL
  • 43
  • 6
2
votes
6 answers

Difference between in signed and unsigned char in c

What is the difference between signed and unsigned char in C ? When I tried to run the following code without unsigned it entered an infinite loop as the range of signed char is up to 127 (Why is it signed by default ?). But when I added unsigned…
user8329645
2
votes
4 answers

print single byte after typecasting to char

I am receiving some data from a socket. After that, I want to print a single byte in the received char array. Below is the code that I used: char buf[100]; int i = 0; …
2
votes
3 answers

Convert char buffer to struct

I have a char buffer buf containing buf[0] = 10, buf[1] = 3, buf[2] = 3, buf[3] = 0, buf[4] = 58, and a structure: typedef struct { char type; int version; int length; }Header; I wanted to convert the buf into a Header. Now I am using…
Akhil V Suku
  • 870
  • 2
  • 13
  • 34
2
votes
3 answers

unsigned char* image to Python

I was able to generate python bindings for a camera library using SWIG and I am able to capture and save image using the library's inbuilt functions. I am trying to obtain data from the camera into Python Image Library format, the library provides…
Chenna V
  • 10,185
  • 11
  • 77
  • 104
2
votes
0 answers

Converting array of unsigned non printable values to string

I have an array of unsigned characters, produced by hash function. I want to convert it to string or ascii code or hexdecimal. The value at the moment are gibberish and hash are nonsense. I need to know how I can convert them. Any help would be…
user153465
  • 123
  • 4
2
votes
3 answers

Pointer to different data type in C

I have compiled and run the following program in C: #include #include #include int main(int argc, char* argv[]){ uint8_t data[8] = {0, 1, 2, 3, 4, 5, 6, 7}; uint32_t* pointer32 = &data[0]; uint64_t* pointer64…
2
votes
1 answer

Openframeworks, creating a video texture from two video grabbers

I am very new to C++ and image processing in general. I want to create a new unsigned char*which represents an array of pixels for use with ofTexture. I currently have two similar arrays which are both from ofVideoGrabber objects. I was hoping to…
Chomp
  • 35
  • 6
2
votes
0 answers

Converting char* to unsigned char array C

I am reading a file that has some data in it. The data is not uniform. But once in a while there might be a line that have a file name and SHA1 sum value in it. I read the data line by line, and then when there is a line with SHA1 sum value, I use…
Neo
  • 349
  • 5
  • 18
2
votes
1 answer

Convert Hex String to Bytes in C++

I am looking for a C++ library function or built-in function that can read a long hexadecimal string (ex. SHA256 hash) and turn that into an unsigned char array. I tried using stringstream for this but to no avail. For example - bool…
smanikar
  • 31
  • 1
  • 2
2
votes
2 answers

Short int variable in c

The following program short b =-10; printf("%x %d",b,sizeof(b)); outputs (on vs 2008) FFFFFFF6 2 Why not FFF6 2 The same is with signed char.
Rohit Bohara
  • 323
  • 4
  • 14