哪位大神帮我看看哪里出问题了
# include <stdio.h># include <conio.h>
# include <windows.h>
# include <stdlib.h>
# include <string.h>
# include <time.h>
# define ROW 5 //行
# define COLUMN 30 //列
void Goto (int column , int row)
{
HANDLE hOut = GetStdHandle (STD_OUTPUT_HANDLE);
COORD xy = {0 , 0};
xy.X = column;
xy.Y = row;
SetConsoleCursorPosition (hOut , xy);
}
SMALL_RECT DrawPane (void)
{
Goto (COLUMN , ROW);
printf ("╔");
for (int i = 0; i < 12; i++)
{
printf ("═");
}
printf ("╗");
for (int i = 1; i <= 16; i++)
{
Goto (COLUMN , ROW + i);
printf ("║");
}
for (int i = 1; i <= 16; i++)
{
Goto (COLUMN + 26 , ROW + i);
printf ("║");
}
Goto (COLUMN , ROW + 16);
printf ("╚");
for (int i = 0; i < 12; i++)
{
printf ("═");
}
printf ("╝");
SMALL_RECT cr = {COLUMN , ROW , COLUMN + 26 , ROW + 16};
return cr;
}
wchar_t * ChangeMultiByteToWideChar (char * Str)//char 类型转换为 wchar_t数据类型。
{
int n;
wchar_t * Wstr;
n = MultiByteToWideChar (CP_ACP , 0 , Str , -1 , NULL , 0);
Wstr = (wchar_t *) malloc (sizeof (wchar_t) * n);
MultiByteToWideChar (CP_ACP , 0 , Str , -1 , Wstr , n);
return Wstr;//每次调用都必须将Wstr释放
}
void Menu (void)
{
// SMALL_RECT cr = DrawPane ();
HANDLE hOut = GetStdHandle (STD_OUTPUT_HANDLE);
COORD BufferSize = {80 , 250};
COORD BufferCoord = {COLUMN+2 , ROW+1 };
// COORD BufferCoord = {1 , 1};
COORD BufferTem = BufferCoord;
CHAR_INFO region , regionarray[80*250];
region.Attributes = BACKGROUND_INTENSITY | FOREGROUND_RED | FOREGROUND_BLUE | FOREGROUND_INTENSITY;
char str[] = "菜单目录";
PWCHAR Wstr = ChangeMultiByteToWideChar (str);
for (int i = 0; i < wcslen (Wstr); i++)
{
region.Char.UnicodeChar = Wstr[i];
regionarray[80*COLUMN+9+(ROW+i)] = region;
// regionarray[80*1+(1+i)] = region;
}
SMALL_RECT cr1 = {COLUMN , ROW , COLUMN + wcslen (Wstr)-1 , ROW};
// SMALL_RECT cr1 = {1 , 1 , wcslen (Wstr) , 1};
WriteConsoleOutput (hOut , regionarray , BufferSize , BufferCoord , &cr1);
free (Wstr);
}
int main (void)
{
// DrawPane ();
Menu ();
return 0;
}
为什么不显示文字呢,到底哪里出问题了,