Getting a players name

Started by
24 comments, last by MTT 20 years, 1 month ago
MTT:

Read the input in like so ...

char szpName[256];

gets(szpName);

Also change the cout in the TextOutput function to puts() and have the TextOutput function take a char instead of the std: stuff.

I'm pretty sure that will work, although I can't test it because my complier keeps crashing on me today.

[edited by - tiffany_smith on February 24, 2004 8:27:18 PM]
Advertisement
since you are using the win32 api, your input and output functions should be win32 api, not iostream.
Yeah, I think thats the way I did it in AsciiRis come to think of it. doh!
EvilCrap: The name is supposed to go after the colen, I am using win32 console. And doesnt getche only get 1 char?

Tiffany_Smith: I tried making it an array and using gets(szpName), and it just jumped to the next part of the game before i could write anything.

DerAnged: i tried using gets(str.c_str());, and i couldnt get it to work, if you could show me what i would look like with szpName (i kinda couldnt figure out where to put it) then it might work, i dont know.
--------------------------http://www.gamedev.net/community/forums/icons/icon51.gif ... Hammer time
MTT: As Evil said, you need to use the win32 api read and write functions.

Edit: Wrong links, I'll quit while I'm not too far behind.

[edited by - tiffany_smith on February 24, 2004 8:50:44 PM]
character mode apps see ReadConsole, WriteConsole, and gander at the entire api.

This topic is closed to new replies.

Advertisement