Click here to Skip to main content
15,904,500 members
Please Sign up or sign in to vote.
3.00/5 (1 vote)
See more:
I want to convert BYTE* to char* so please give me sample code.

Thanks in advance.
Posted
Updated 16-Mar-10 3:26am
v3

It could be implement as following :) :
BYTE byData[] = {65, 65, 65, 0};
char* pchData = (char*) byData;
 
Share this answer
 
v2
If you know what are you doing (i.e. why don't you provide context info?) then a cast will do the job. For instance:
C++
BYTE * b = new BYTE[4];
b[0] = 0x46;
b[1] = 0x4F;
b[2] = 0x4F;
b[3] = 0x00;
char * s;
s = reinterpret_cast<char *>(b);
cout << s << endl;
delete [] b;

:)
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900