Questions tagged [unsigned-char]
321 questions
0
votes
2 answers
Subtraction operation on unsigned char
I have a curiosity about unsigned char. I have a curiosity about unsigned char. I did a subtraction operation on unsigned char accidentally.I know i am not supposed to do that. But i am bit curious about how a particular answer came. Can anybody…

Varo
- 831
- 1
- 7
- 16
0
votes
1 answer
C++ - Copying unsigned char* to a new unsigned char* array
This is a followup question to to the question I posted here, although it different enough to warrant posting a new question.
I have a OpenCV (cv::Mat) matrix variable (which is just an unsigned char * of with a known size). I used the answer in the…

Brett
- 11,637
- 34
- 127
- 213
0
votes
1 answer
How to tell Swig to treat 'u_char *' as 'unsigned char *'
I'm wrapping a C library using Swig to be able to use it in PHP. The library uses u_char * instead of unsigned char *. Swig treats the u_char as a structure that it doesn't know about.
This results in the generated code doing a check to for the…

Danack
- 24,939
- 16
- 90
- 122
0
votes
2 answers
Print of unsigned char different each time
So I'm trying to use cbc_crypt to try encrypting and decrypting different strings. Here is my program so far.
int main(int argc, char *argv[])
{
unsigned char key[8] = {0x00, 0x00, 0x00, 0x68, 0x67, 0x01, 0x75, 0x19};
unsigned char iv[8] =…

user244145
- 73
- 1
- 11
0
votes
2 answers
Magical printing with unsigned char in C
Last semester I took a class in operating systems. I wasn't surprised that the whole class was taught in C but the heavy use of it seemed to annoy some people of the class. When the course was over couple of those who disliked the language were…

Donna
- 657
- 1
- 8
- 18
0
votes
1 answer
Debug Assertion Failed File, tokenScanner, and text files
I have written a program that processes text files one at a time and extract relevant information. My program works well with some of the text files and not others. There is no obvious difference between the files that run seamlessly through my…

user2792668
- 1
- 1
0
votes
0 answers
How to convert an unsigned char array in C to string, and use that string to convert back to a Java unsigned char array?
Here is my C method:
unsigned char *pixel = GetTheCamPixel();
//Do something to convert it to string
//Send this string to a java client
After my Java client received the string, I would like to convert it back to a Java unsigned char…

DNB5brims
- 29,344
- 50
- 131
- 195
0
votes
0 answers
Uchar equivalent in Java
I want to convert some C++ code to Java and I need Java equivalent of uchar to use the below C++ code.
cvSetReal2D(output, x, y, CV_MAT_ELEM(input, uchar, y, x));

Shah
- 661
- 2
- 9
- 19
0
votes
1 answer
Conversion from unsigned int array to unsigned char array
I don't know how to convert an array of unsigned int to an array of unsigned char in a good way. I would like to receive some suggestions.
To be more clear, my problem is that I have a function that read memory putting data in unsigned int array. I…

Leandro Lima
- 1,140
- 3
- 24
- 42
0
votes
2 answers
Reading text from file to unsigned char array, errors while trying to use example
I'm trying to use example from:
https://stackoverflow.com/a/6832677/1816083
but i have:
invalid conversion from `unsigned char*' to `char*'
initializing argument 1 of `std::basic_istream<_CharT, _Traits>& std::basic_istream<_CharT,…

cerber
- 1
- 1
- 1
- 7
0
votes
2 answers
C++ Retrieving the Unicode Code Point in Hex
I wanted to do retrieve unicode representation in hex for characters. For an example, for the character €, the value should be 0x0080. I need to do this only for the ISO 8859-1, the first 256 characters of the unicode encoding. So I used casting to…

Izza
- 2,389
- 8
- 38
- 60
0
votes
3 answers
Read unsigned chars into string
I have an array of unsigned chars:
unsigned char buffer[BUFFER_SIZE];
I want to read in the first N unsigned chars from that array into a string however after looking at strncpy(), that seems to only take pointers to signed chars.
Should I be…

Patrick
- 63
- 3
- 10
0
votes
2 answers
Is this strange function converting string to binary?
I am doing bug fixing on a old c code in our system ( strangely enough, it's not standard c. It is not compiled by gcc ). I come to this code which seems to be converting a string to binary code in unsigned char format. The logic puzzle me ( bold…

lamwaiman1988
- 3,729
- 15
- 55
- 87
0
votes
1 answer
Working with unsigned char. How to replace elements without using loop?
I'm developing an application that should use very few resources and be very fast. And in my app I use an unsigned char* rawData which contains bytes got from image. So in this rawData array I have to keep some bytes and others set to zero. But I'm…

Garnik
- 423
- 1
- 6
- 20
-1
votes
3 answers
reinterpret_cast on pointers pitfall between char and unsigned char?
I'm using the following function in order to create an UUID and write it in a human-readable form into a pre-allocated buffer. Something goes wrong.
void createUUID(char* pDst)
{
UUID lUUIDObj;
UuidCreate(&lUUIDObj);
unsigned char* …

moala
- 5,094
- 9
- 45
- 66