Convert from char to unsigned char 
Author Message
 Convert from char to unsigned char

As I can convert a variable of char type to unsigned char type?
Thanks.

-----------------------------------------------
Sebastian Piccolotto



Tue, 30 Sep 2003 00:18:49 GMT  
 Convert from char to unsigned char

Quote:

>As I can convert a variable of char type to unsigned char type?
>Thanks.

A single-byte character? Just assign it.

char  c = 'a';
unsigned int i;

i = c;

i now equals 97.

The compiler may warn you that a sign could be lost, but it should
compile and run.

--
Tim Slattery
MS MVP(DTS)



Tue, 30 Sep 2003 00:27:12 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. converting const char* to unsigned char[1024]

2. Newbie: Can not convert for char to unsigned char

3. Convert from char to unsigned char

4. Q: How can i convert a char* to unsigned char*

5. Converting unsigned char to signed char invokes UB?

6. Sorting a Huge Unicode File use strcmp(unsigned char *, unsigned char *)

7. Sorting a Huge Unicode File use strcmp(unsigned char *, unsigned char *)

8. Sorting a Huge Unicode File use strcmp(unsigned char *, unsigned char *)

9. char, unsigned char, signed char

10. How to convert unsigned long to unsigned char?

11. To convert unsigned char to unsigned short in VC++

12. To convert unsigned char to unsigned short in VC++

 

 
Powered by phpBB® Forum Software