Questions tagged [unsigned-char]
321 questions
0
votes
3 answers
memcpy not copying into buffer
I have a class with a std::vector mPacket as a packet buffer (for sending UDP strings). There is a corresponding member variable mPacketNumber that keeps track of how many packets have been sent so far.
The first thing I do in the…

nathan lachenmyer
- 5,298
- 8
- 36
- 57
0
votes
1 answer
Sockets: Passing unsigned char array from C to JAVA
C side:
unsigned char myBuffer[62];
fread(myBuffer,sizeof(char),62,myFile);
send(mySocket, myBuffer, 62,0);
JAVA side:
bufferedReader.read(tempBuffer,0,62);
Now in JAVA program i receive (using socket) values less than 0x80 in C program with no…

MTC Developer
- 11
- 2
0
votes
2 answers
What is the maximum allowed size of an "unsigned char" array in Visual C++ 6.0?
For working with graphics, I need to have an array of unsigned char. It must be 3 dimensional, with the first dimension being size 4, (1st byte Blue, 2nd byte Green, 3rd byte Red, 4th byte Unused). A simple array for a 640x480 image is then done…

Ben Hutchinson
- 49
- 1
- 5
0
votes
3 answers
unsigned char to unsigned char array of 8 original bits
I am trying to take a given unsigned char and store the 8 bit value in an unsigned char array of size 8 (1 bit per array index).
So given the unsigned char A
Id like to create an unsigned char array containing 0 1 0 0 0 0 0 1 (one number per…

David Baez
- 1,208
- 1
- 14
- 26
0
votes
1 answer
C conver unsigned char to HEX
is convert unsigned char / int to hex, trouble is no correct translate ascci table:
original: 0D, converted: AD
code:
char int_to_hex(int d) {
if (d < 0) return -1;
if (d > 16) return -1;
if (d <= 9) return '0' + d;
d -= 10;
return…

Den68
- 27
- 6
0
votes
2 answers
Hexadecimal enumeration OR integer (ASCII) enumeration to fill a byte array with?
I need to fill a byte array in c language by the possible enumerations.
Here it is how I declare my byte array:
unsigned char byteArray[6];
And now I hesitate if my enumrations should look like MyEnum1 or MyEnum2:
enum MyEnum1 { A1 = 0, B1 = 1, C1…

Farah
- 2,469
- 5
- 31
- 52
0
votes
0 answers
Reading/writing an unsigned char* with fstream
I have a problem with this function. The result it's giving doesn't match the original data. I can't find the cause of the problem. Encoding and decoding png works fine, but as i save and load the pixels raw data between encoding, it cannot be…
0
votes
1 answer
OpenAL causing leaks in my iPhone game
I am integrating OpenAL in my iPhone game from code I found in this post, but the compiler gave me an error on this line of code:
unsigned char *outData = malloc(fileSize);
so I changed it to this:
unsigned char *outData = (unsigned char*)…

AptoTech
- 1
0
votes
0 answers
How to change string array into unsigned char*?
I have two arrays:
array^ lub=gcnew array(24);
const unsigned char *lb[24];
I want to copy the values from the first array, lub into lb;
How can i do it?
What conversion methods do I need to use?
0
votes
2 answers
Writing to a text file, binary vs ascii
So I am having the hardest time trying to understand this concept. I have a program that reads a text file, and writes it to another file and replaces the most common words with unsigned chars. But what I cannot for the life of me understand is how…
user2680027
0
votes
4 answers
how to move in bytes in an unsigned char in c
let's say that i have an unsigned char declared as follow :
unsigned char Data[DATA_BLOCK_SIZE] = {0};
What is the meaning of expression Data+1?

Anass Boukalane
- 539
- 10
- 26
0
votes
1 answer
Join two unsigned chars + mallock u_chars
How does one properly allocate array of unsigned chars?
packet = (u_char*) malloc (20*sizeof(u_char)); //is it simmilar to u_char packet[20]?
I have 2 functions which are declared as follows
u_char *frame(bool type, char* srcmac, char*…

Kyslik
- 8,217
- 5
- 54
- 87
0
votes
3 answers
Pointer type conversion: effect on buffer length?
Char is 1 byte
unsigned short is 2 bytes
So if I cast a char * to unsigned short *, will it change the length of the buffer?
For example I am passing char * and length to a VUMeter function. The function casts the char * to unsigned short *:
short*…

James
- 113
- 1
- 6
0
votes
2 answers
unsigned char allocation comes nils in offset value objective c
I am getting the pixel colour values from touch points. I am successfully doing this but after sometimes app is giving the error( EXC_BAD_ACCESS(CODE=1,address=0x41f6864). Its memory allocation problem here is the source code for your reference.
-…

Tanuj Singh
- 11
- 2
0
votes
1 answer
How can I print unsigned char as ascii
I'm trying to convert unsigned char to ascii text. How can I do it?
I have tried this, but it is wrong:
typedef struct mtmheader
{
unsigned char objName[20];
unsigned char msgType[2];
}mtmheader;
mtmheader h;
processMTMHeader(datap,&h,…

MaMu
- 1,837
- 4
- 20
- 36