Questions tagged [unsigned-char]
321 questions
1
vote
1 answer
Audio data (unsigned char) that have been manipulated cannot be played
I have trouble with playing audio data after they have been manipulated.
The only API I use is the alsa lib API on Linux (Ubuntu) in C.
I get the data from a 16 bits integer wave file in a unsigned char array (called buffer1) using read() and…

victor
- 11
- 3
1
vote
3 answers
unsigned char limited to 127 on osx lion?
I am facing a strange issue, working on my mac osx lion (under xcode4/clang, though it is reproducible with gcc4.2).
It seems, that I can not assign any value above 127 for a unsigned char variable. So, when I assign
v = (unsigned char) 156;
or,…

Nikhil J Joshi
- 1,177
- 2
- 12
- 25
1
vote
1 answer
Can I use a crypted hash as a filename or do I have to convert it first?
I am trying to hash a string then use that hash as the name of a file.
My problem: is that all the C++ hashers/crypters I have come across hash a std::string or char* & return the hashed string as an unsigned char*?
How do I convert that unsigned…

sazr
- 24,984
- 66
- 194
- 362
1
vote
1 answer
Converting an unsigned char* to readable string & whats this function doing
I have googled alot to learn how to convert my unsigned char* to a printable hex string. So far I am slightly understanding how it all works & the difference between signed & unsigned chars.
Can you tell me what this function I found does? And help…

user593747
- 1,484
- 4
- 32
- 52
1
vote
1 answer
how to create unsigned char type array dynamically in objective c
I want to create an unsigned char array in objective c from the values of another nsmutablearray,
Please help me
unsigned char buffer2[24];
buffer2[0] = 0X55; buffer2[1]=0x66; buffer2[2]=0x77; buffer2[3]=0x88; buffer2[4]=0x44;//print…

Shivomkara Chaturvedi
- 1,697
- 7
- 28
- 42
1
vote
2 answers
Search for a string in memory
I'm trying to get this code to work, from here
char *mem = (unsigned char *) 0xF0000;
int length, i;
unsigned char checksum;
while ((unsigned int) mem < 0x100000) {
if (mem[0] == '_' && mem[1] == 'S' && mem[2] == 'M' &&…

yolo
- 2,757
- 6
- 36
- 65
1
vote
1 answer
How to read an Unsigned Char image file to Python?
I have an text file called with the extension '.image', at the top of the file is the following:
Image Type: unsigned char
Dimension: 2
Image Size: 512 512
Image Spacing: 1 1
Image Increment: 1 1
Image Axis Labels: "" ""
Image Intensity Label:…
user14909015
1
vote
5 answers
What does *= do?
Hey I am kinda new to C and I wanted to ask why this prints out 4 instead of 260?
#include
int main()
{
unsigned char x = 130;
x *= 2;
printf("%d\n", x);
}

Alpha
- 319
- 2
- 12
1
vote
1 answer
Type conversion issues unsigned char, string, hex
The following code has several issues - for which I'm kindly asking for your input / corrections / feedback - of various types: first, I can't get it to do what I'd like to, namely pass it a "word" and have it output its elf_hash. The code for the…

cg79
- 63
- 5
1
vote
0 answers
error: narrowing conversion of ‘-58’ from ‘int’ to ‘char’ [-Wnarrowing]
I'm trying to compile https://github.com/jbeder/yaml-cpp on a Raspberry Pi, and I'm getting this error:
/home/pi/yaml-cpp/test/binary_test.cpp:11:38: error: narrowing conversion of ‘-58’ from ‘int’ to ‘char’ [-Wnarrowing]
11 | std::string…

OZ1SEJ
- 399
- 1
- 5
- 14
1
vote
1 answer
How to convert unsigned char to unsigned int in c++?
I have the following piece of code:
const unsigned char *a = (const unsigned char *) input_items;
input_items is basically the contents of a binary file.
Now a[0] = 7, and i want to convert this value to unsigned int. But when I do the…

Mobi Zaman
- 605
- 1
- 6
- 19
1
vote
1 answer
unsigned char in C not working as expected
Since unsigned char represents 0 - 255 and the extended ascii code for 'à' is 133, I expected the following C code to print 133
unsigned char uc;
uc='à';
printf("%hhu \n",uc);
Instead, both clang and gcc produce the following error
error:…

redwood_gm
- 343
- 2
- 11
1
vote
0 answers
enum size and initialization of variable
Even setting the size of an enum is not enough to be able to assign it to a variable of the same size (http://coliru.stacked-crooked.com/a/edd287393f172abd):
#include
#include
enum class Command : uint8_t
{
CMD1 = 0x48,
…

vegalock
- 51
- 7
1
vote
1 answer
Unsigned char out of bounds for value 247?
I’m trying to cast the value 247 to a char in C++ (Visual Studio).
I’m getting a Debug Assertion Failed error, saying unsigned(c+1) should be less than or equal to 256. I don’t understand where this is coming from since the value 247 falls in that…

liz
- 11
- 3
1
vote
3 answers
C++ iostream >> operator behaves differently than get() unsigned char
I was working on a piece of code to do some compression, and I wrote a bitstream class.
My bitstream class kept track of the current bit we are reading and the current byte (unsigned char).
I noticed that reading the next unsigned character from the…

Setheron
- 3,520
- 3
- 34
- 52