cannot convert parameter 1 from 'char [80]' to 'LPCWSTR'

来源:百度知道 编辑:UC知道 时间:2024/05/25 00:35:21
Here are the codes:
#include<stdlib.h>
#include <windows.h>
#include <stdio.h>
#include <iostream>
using namespace std;
#include "conio.h";
class MyPosition;
class MyScreen
{
public:
void PrintMyPosition(MyPosition* pMyPosition);
};
class MyPosition
{
public:
int x,y;
void DisplayMyPosition(MyScreen* pMyScreen);
};
void MyScreen::PrintMyPosition(MyPosition* pMyPosition)
{
HANDLE hConsoleOutput=GetStdHandle(STD_OUTPUT_HANDLE);
COORD dwCursorPosition={1, 10};
char sz[80];
sprintf(sz, "My position is (%d,%d).", pMyPosition->x, pMyPosition->y);
DWORD cWritten;
WriteConsoleOutputCharacter(hConsoleOutput, sz, lstrlen(sz),dwCursorPosition, &cWritten);
dwCursorPosition.X=pMyPosition->x;
dwCursorPosition.Y=pMyPosition->y;
SetConsoleCursorPosition(hConsoleOutput,dwCursorPosition);
}
void

你的工程是不是一个Unicode工程?
Unicode共成立有时默认字符串是wchar_t型的,而不是char型的
你到工程设置页面里找,找到一项“使用Unicode字符”,改成“使用多字节字符”

but on my pc the programme is fine,is the programme to display a piont
that you has been given it's two coordinates?