SetConsoleTextAttribute : Foreground only
<p>I would like to change ONLY the foreground color text of my console application, not the background text color nor the console background color. In Other words: I want to keep previous colors like they are except the foreground text color.</p>

<p>Presently i use the code below but the background under the text change too.</p>

<pre><code>#include &lt;windows.h&gt;
#include &lt;iostream&gt;
using namespace std;

int main(int argc, char* argv[])
{

    SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_GREEN);
    cout &lt;&lt; "green?" &lt;&lt; endl;
    cin.ignore();
    return 0;
}
</code></pre>
