我是C++新手,请教个问题

来源:百度知道 编辑:UC知道 时间:2024/07/12 07:28:37
编译时产生如下错误:cannot convert parameter 4 from 'char (*__w64 )[11]' to 'LPCSTR'.
错出在:
char text[]="床前明月光";
TextOut(hdc,50,50,&text,20);
这里

或&text[0]

# include <iostream>
# include <windows.h>
using namespace std;
void main()
{
HDC hdc;
hdc= GetDC(0);
char text[]="床前明月光";
TextOut(hdc,50,50,&text[0],10);
ReleaseDC(0,hdc);
getchar();

}

TextOut(hdc,50,50,text,20);