Jump to content
  • Advertisement
Sign in to follow this  
greencrayon

Problems with strings.

This topic is 4082 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi everyone. I am very new to programming and apologise for my lack of knowledge when it comes to my correct use of terminology… I hope I can explain my questions clearly enough. I am currently making a text game using that console window thingy. The problem I have is using a string to take the name of the user’s adventurer. If the user’s name includes a space (it should not, I explicitly tell them not to... but you know people) the program seems to object and the console screen spams away worse than an MMO plat seller. Is there a way I can check user input so that it tells them off for entering a name containing a space? Or maybe take the space as part of the string? I have another unrelated question. Because of a new-years resolution sweepstake at a party my “amusing” friends conspired to make the most technophobic person on the planet into a game programmer. Now that I have some games under my belt I would like to get revenge by pestering them with my trivial projects. How do I distribute my games to my friends? Do I just send them the .exe file? Or is it more complicated than this? Please forgive my lack of knowledge, up until early this year I did not even know how to open a folder on my PC.

Share this post


Link to post
Share on other sites
Advertisement
What programming language are you using? Assuming C++, this thread from earlier today should help you out.

Distributing your games can be a fairly involved process. At the very least you need the .EXE of course; there may also be some other system-type files that need to be distributed. Typically these are .DLL files. The actual files you need depends heavily on the language you're using, and the particular tools; for instance, distributing a Python game is a different scenario from a C++ game, and even for C++, Visual Studio and the GCC compiler families will have different requirements.

Congratulations on getting this far, though - for a self-proclaimed technophobe it's quite an accomplishment to be writing programs already [smile]

Share this post


Link to post
Share on other sites
Language?

Assuming C++, use getline() to read a line of text instead of just a word. Use cin.ignore() to ignore what it in standard input prior to a given prompt.

Share this post


Link to post
Share on other sites
Quote:
Original post by greencrayon
How do I distribute my games to my friends? Do I just send them the .exe file? Or is it more complicated than this? Please forgive my lack of knowledge, up until early this year I did not even know how to open a folder on my PC.
Again, assuming C++, yes all you need to do is send the exe. Your programs will not be cross platform however; if you make them in windows they will only playable on windows compatible computers.

Share this post


Link to post
Share on other sites
Thanks for the pointers guys, yes getline seems like just the thing I need. So I just send the exe? splendid /rubs hands together. They wont know what hit them.

Share this post


Link to post
Share on other sites
Yup, for the console stuff it's mainly just going to be the *.exe. When you move onto bigger projects you may end up including dynamic link libraries (*.dll files) in your program which means you will also have to include them with the exe. And there is also, of course, storing your own data in files, i.e. maps, models, textures etc. You would need to include them with youe exe as well (unless you make them a party of your "resources" which means they will be embedded in the *.exe, but don't worry about that just yet).

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!