---------- Issues in Console Programming ---------- |
In this series of articles I intend to cover both the "how-to" of programming console applications but also the
reasons that things are done the way they are.
The purpose of these articles is threefold:
1
First, this information is rather scattered about the internet. It sure would be nice to have it all in one spot. I don't aim to cover every possible issue, but I do intend to have a complete primer.
2
Second, some of these issues are a constant sore spot for forum regulars (on forums everywhere). These questions get asked so often that people tire of answering them, and start giving simple answers just to shut the asker up. Answering a question takes a fair amount of energy, and when someone shows up two days after some brilliant answer to ask some simple variation, it makes us want to unplug his computer with a pair of wire-cutters. These articles aim to provide an easy, canned answer that makes everyone happy.
3
Third, I intend to encourage people to think properly about how they are programming. Too often these days programmers fall into the trap of believing that the computer will help them program. This is true of all
other computer activities, but
not programming. Programming the computer requires careful thought and insight. Simple answers are simply the Wrong Thing. It is better to get a good, comprehensive answer that makes you more capable, skilled, and valuable -- a
better programmer than the average wannabe. Don't be a liability to your software!
-------------------- For The Brain -------------------- |
Why system() is
evil
http://www.cplusplus.com/forum/articles/11153/
How to set up a nice console-programming environment
-- todo --
Types and purposes of console applications
-- todo --
Issues when reading user input
-- todo --
Making your application well-behaved
-- todo --
Windows and Linux issues
-- todo --
Getting started with Curses
-- todo --
Using <conio.h>
-- todo --
Using Win32
-- todo --
Using POSIX
-- todo --
-------------------- For The Body -------------------- |
Keep the console open long enough to see your program's output
http://www.cplusplus.com/forum/articles/7312/
Flush stdin
-- todo --
Clear the screen
http://www.cplusplus.com/forum/articles/10515/
Read a password
-- todo --
Read arrow keys and other fancy stuff
-- todo --
Know whether or not a key is pressed
-- todo --
Read a single key for input (without having to press
Enter)
-- todo --
Use timeouts or delays when getting input
-- todo --
Change the text colors
-- todo --
Change the console window's title
-- todo --
Cursor position
-- todo --
Mouse input
-- todo --
Determine if there is a human interacting with the program
-- todo --
------------------- Actualization ------------------- |
Console Functions Source Code (Win32 and POSIX)
-- todo --
-------------------- Boilerplate -------------------- |
First off, I wrote all this code. The articles are designed to be as cut-n-paste as possible so that you can get along with your life and not worry too much about making things work. That said, though, in many cases the code, while relatively simple, is still
way above your heads. I don't care if you graduated last spring, with honors. Or if you've been working in C or C++ for the past five years. I don't care if your IQ is greater than mine. If you knew this stuff you wouldn't need me. Learn from it. But don't present it as your own. Professors and professionals alike hate cheaters. Be honest and enjoy the code, and share it with others.
For students, remember that your professor is more interested in seeing you solve problems than write amazing code. Amazing code and cool solutions are nothing more than a bonus. Code
you wrote and understand, and that
does what it is supposed to do is the goal.
Always. (That truth never changes!)
This is obviously a work in progress. If I haven't answered your question yet, either post on the beginner's forum or ask me to write it next. You can also spend time looking through the following:
Comments, suggestions, clarifications, corrections, and tactful critisisms are, as always, welcome.
Hope this helps
-- DĂșthomhas