开发者

Getting a character and printing it in VC++

I have a problem getting a character from the user in VC++.the function i want to use uses the char format so when i get the input using getch() it gives me an error that can't convert 'int' t开发者_如何转开发o 'char'. could someone please help me how to get the input in char format please?

edit:

char key1[10]; 
key1=getch(); 
Main.draw_text(key1,120+(i*40),250,White,Black,20);


you would be better off editing your post instead of posting a code snippet in a comment.

Anyway, from the code it looks like you think getch() return a string, but it returns only one char, to get a string you need to use for instance

gets(key1);
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜