|
-
Jul 17th, 2003, 07:44 PM
#1
Thread Starter
Hyperactive Member
unsigned char to const char *
I have this code:
Code:
int systeminfo()
{
SYSTEM_POWER_STATUS sps;
HDC hdc;
GetSystemPowerStatus(&sps);
hdc = GetDC(hwnd);
TextOut(hdc,5,5,sps.ACLineStatus,3);
ReleaseDC(hwnd,hdc);
return 0;
}
error C2664: 'TextOutA' : cannot convert parameter 4 from 'unsigned char' to 'const char *'
Conversion from integral type to pointer type requires reinterpret_cast, C-style cast or function-style cast
Error executing cl.exe.
how do i format this to work? Thanks
and i get the error:
Matt 
-
Jul 17th, 2003, 08:29 PM
#2
Frenzied Member
one way:
Code:
int systeminfo()
{
SYSTEM_POWER_STATUS sps;
HDC hdc;
char tmp[4];
GetSystemPowerStatus(&sps);
hdc = GetDC(hwnd);
memset(tmp,0x00,sizeof(tmp));
tmp[0]=sps.ACLineStatus;
TextOut(hdc,5,5,tmp,3);
ReleaseDC(hwnd,hdc);
return 0;
}
-
Jul 18th, 2003, 02:15 AM
#3
Why 4 characters long? For alignment?
All the buzzt
 CornedBee
"Writing specifications is like writing a novel. Writing code is like writing poetry."
- Anonymous, published by Raymond Chen
Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.
-
Jul 18th, 2003, 03:52 PM
#4
Frenzied Member
Yes. - habit from HP unix.
-
Jul 19th, 2003, 04:16 AM
#5
All the buzzt
 CornedBee
"Writing specifications is like writing a novel. Writing code is like writing poetry."
- Anonymous, published by Raymond Chen
Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|