<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Textformat]]></title><description><![CDATA[<p>Ich schreibe zurzeit eine Konsolen Anwendung (Cross-Plattform)<br />
und wollte heute Farben support implementieren:</p>
<p>textformat.cpp</p>
<pre><code>#include &lt;textformat.h&gt;

const char * TEXTFORMAT::BLACK         = &quot;\xc2\xa7&quot;&quot;0&quot;;
const char * TEXTFORMAT::NAVY          = &quot;\xc2\xa7&quot;&quot;1&quot;;
const char * TEXTFORMAT::GREEN         = &quot;\xc2\xa7&quot;&quot;2&quot;;
</code></pre>
<p>textformat.h</p>
<pre><code>#ifndef _TEXTFORMAT_H
#define _TEXTFORMAT_H

class TEXTFORMAT
{
public:

	static const char * BLACK;
	static const char * NAVY;
	static const char * GREEN;
};
#endif
</code></pre>
<p>und jetzt wollte ICH euch fragen ob ihr eine Methode kennt womit ich meinen Text in Grüner Farbe ausgeben könnte kennt?</p>
<pre><code>Server-&gt;getLogger-&gt;info(TEXTFORMAT::GREEN&quot;Grünner Text&quot;)
</code></pre>
<p>Als beispiel</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/329945/textformat</link><generator>RSS for Node</generator><lastBuildDate>Fri, 03 Jul 2026 18:51:42 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/329945.rss" rel="self" type="application/rss+xml"/><pubDate>Mon, 15 Dec 2014 16:15:25 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Textformat on Mon, 15 Dec 2014 16:15:25 GMT]]></title><description><![CDATA[<p>Ich schreibe zurzeit eine Konsolen Anwendung (Cross-Plattform)<br />
und wollte heute Farben support implementieren:</p>
<p>textformat.cpp</p>
<pre><code>#include &lt;textformat.h&gt;

const char * TEXTFORMAT::BLACK         = &quot;\xc2\xa7&quot;&quot;0&quot;;
const char * TEXTFORMAT::NAVY          = &quot;\xc2\xa7&quot;&quot;1&quot;;
const char * TEXTFORMAT::GREEN         = &quot;\xc2\xa7&quot;&quot;2&quot;;
</code></pre>
<p>textformat.h</p>
<pre><code>#ifndef _TEXTFORMAT_H
#define _TEXTFORMAT_H

class TEXTFORMAT
{
public:

	static const char * BLACK;
	static const char * NAVY;
	static const char * GREEN;
};
#endif
</code></pre>
<p>und jetzt wollte ICH euch fragen ob ihr eine Methode kennt womit ich meinen Text in Grüner Farbe ausgeben könnte kennt?</p>
<pre><code>Server-&gt;getLogger-&gt;info(TEXTFORMAT::GREEN&quot;Grünner Text&quot;)
</code></pre>
<p>Als beispiel</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2432990</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2432990</guid><dc:creator><![CDATA[Sanjey]]></dc:creator><pubDate>Mon, 15 Dec 2014 16:15:25 GMT</pubDate></item><item><title><![CDATA[Reply to Textformat on Mon, 15 Dec 2014 18:09:56 GMT]]></title><description><![CDATA[<p>windows:</p>
<pre><code class="language-cpp">//farben werte kannste hier rauslesen, bin gerade zu faul die msdn seite zu suchen:
	namespace foreground
	{
		typedef int type;
		type blue = 0x1;
		type green = 0x2;
		type red = 0x4;
		type intensity = 0x8;
	}

	namespace background
	{
		typedef unsigned type;
		type black = 0;
		type blue = 0x10;
		type green = 0x20;
		type red = 0x40;
		type intensity = 0x80;
	}
</code></pre>
<pre><code class="language-cpp">HANDLE console_hwnd = GetStdHandle(STD_OUTPUT_HANDLE);
SetConsoleTextAttribute(console_hwnd, background | foreground);
//ausgabe

//ggf. wieder farbe zurücksetzen
</code></pre>
<p>wobei background und foreground werte von oben sind.</p>
<p>bb</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2433012</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2433012</guid><dc:creator><![CDATA[un_skilled]]></dc:creator><pubDate>Mon, 15 Dec 2014 18:09:56 GMT</pubDate></item><item><title><![CDATA[Reply to Textformat on Mon, 15 Dec 2014 18:15:02 GMT]]></title><description><![CDATA[<p>Danke doch ich suche eine Methode für Cross Plattform Support</p>
<blockquote>
<p>Ich schreibe zurzeit eine Konsolen Anwendung (Cross-Plattform)</p>
</blockquote>
]]></description><link>https://www.c-plusplus.net/forum/post/2433014</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2433014</guid><dc:creator><![CDATA[Sanjey]]></dc:creator><pubDate>Mon, 15 Dec 2014 18:15:02 GMT</pubDate></item><item><title><![CDATA[Reply to Textformat on Mon, 15 Dec 2014 19:12:55 GMT]]></title><description><![CDATA[<p>Sanjey schrieb:</p>
<blockquote>
<p>Danke doch ich suche eine Methode für Cross Plattform Support</p>
<blockquote>
<p>Ich schreibe zurzeit eine Konsolen Anwendung (Cross-Plattform)</p>
</blockquote>
</blockquote>
<p>Es gibt aber keine cross-platform Methode, um die Farbe zu setzen, direkt in der Standardbibliothek.<br />
Du hast zwei Möglichkeiten:<br />
-Du lädst dir eine externe, cross-platform Bibliothek herunter<br />
-Du implementierst die Funktionen selber, intern switcht so eine Bibliothek nämlich auch nur via #ifdef die Funktionen abhängig von der Implementierung.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2433025</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2433025</guid><dc:creator><![CDATA[Nathan]]></dc:creator><pubDate>Mon, 15 Dec 2014 19:12:55 GMT</pubDate></item></channel></rss>