<?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[String engabe als #define]]></title><description><![CDATA[<p>Hallo</p>
<pre><code class="language-cpp">#define KEYWORD &quot;viel text der hier steht&quot; 

String eingabe = &quot;KEYWORD&quot;; 

cout &lt;&lt; eingabe;
</code></pre>
<p>Jetzt kommt bei der ausgabe aber KEYWORD und nicht die #define KEYWORD.<br />
Kann ich jetzt auch mit dem stringe eingabe die #define KEYWOR ausgeben?</p>
<p>Gruss localhost</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/117510/string-engabe-als-define</link><generator>RSS for Node</generator><lastBuildDate>Fri, 21 Aug 2026 02:49:19 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/117510.rss" rel="self" type="application/rss+xml"/><pubDate>Mon, 08 Aug 2005 13:08:29 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to String engabe als #define on Mon, 08 Aug 2005 13:08:29 GMT]]></title><description><![CDATA[<p>Hallo</p>
<pre><code class="language-cpp">#define KEYWORD &quot;viel text der hier steht&quot; 

String eingabe = &quot;KEYWORD&quot;; 

cout &lt;&lt; eingabe;
</code></pre>
<p>Jetzt kommt bei der ausgabe aber KEYWORD und nicht die #define KEYWORD.<br />
Kann ich jetzt auch mit dem stringe eingabe die #define KEYWOR ausgeben?</p>
<p>Gruss localhost</p>
]]></description><link>https://www.c-plusplus.net/forum/post/847965</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/847965</guid><dc:creator><![CDATA[localhost]]></dc:creator><pubDate>Mon, 08 Aug 2005 13:08:29 GMT</pubDate></item><item><title><![CDATA[Reply to String engabe als #define on Mon, 08 Aug 2005 13:12:51 GMT]]></title><description><![CDATA[<p>So:</p>
<pre><code class="language-cpp">std::string eingabe = KEYWORD;
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/847970</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/847970</guid><dc:creator><![CDATA[BigBoomer]]></dc:creator><pubDate>Mon, 08 Aug 2005 13:12:51 GMT</pubDate></item><item><title><![CDATA[Reply to String engabe als #define on Mon, 08 Aug 2005 13:13:05 GMT]]></title><description><![CDATA[<p>In diesem fall brauchst du die zuweisung garnicht. Du hast ja die compilezeit-konstante definiert.</p>
<pre><code class="language-cpp">#define KEYWORD &quot;foo&quot;

std::cout&lt;&lt;KEYWORD;
</code></pre>
<p>Nachdem der präpro drüber gerauscht ist siehts etwa so aus</p>
<pre><code class="language-cpp">std::cout&lt;&lt;&quot;foo&quot;;
</code></pre>
<p>Ist also effektiv das gleiche als würdest du das direkt schreiben.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/847971</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/847971</guid><dc:creator><![CDATA[prolog]]></dc:creator><pubDate>Mon, 08 Aug 2005 13:13:05 GMT</pubDate></item><item><title><![CDATA[Reply to String engabe als #define on Mon, 08 Aug 2005 13:16:04 GMT]]></title><description><![CDATA[<p>String eingabe = KEYWORD;<br />
denn in deinem</p>
<pre><code class="language-html">&lt;span title=&quot;makros sind böse&quot;&gt;MAKRO&lt;/span&gt;
</code></pre>
<p>sind die anführungszeichen ja schon drin.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/847974</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/847974</guid><dc:creator><![CDATA[volkard]]></dc:creator><pubDate>Mon, 08 Aug 2005 13:16:04 GMT</pubDate></item><item><title><![CDATA[Reply to String engabe als #define on Mon, 08 Aug 2005 13:25:00 GMT]]></title><description><![CDATA[<p>base_info.h</p>
<pre><code class="language-cpp">//*00000000000000000000000000000001
#define	TITE_00000000000000000000000000000001	&quot;Titel&quot;
#define	NAME_00000000000000000000000000000001	&quot;Musterman&quot;
#define	DATA_00000000000000000000000000000001	&quot;06.08.2005&quot;
#define	INFO_00000000000000000000000000000001	&quot;Text zum tiel \n&quot;\
						&quot;Hier steht eine menge text zum titel blablabla.\n&quot;\
</code></pre>
<p>Die zuordung ist in meine code aber da.</p>
<p>Also ich hab eine datei.h<br />
mit jede menge #define</p>
<p>in im hauptprogramm hab ich</p>
<pre><code class="language-cpp">#include&lt;iostream&gt;
#include&lt;string&gt;
#include&lt;fstream&gt;
#include&quot;base_info.h&quot;
using namespace std;

int main()
{
	string buffer;
	string auslesen_TITE;
	string auslesen_NAME;
	string auslesen_DATA;
	string auslesen_INFO;

	ifstream file(&quot;base_info.h&quot;);	// datei auszulessen
	while(file.good())
	{
		getline(file, buffer,'\n');
		if(buffer.find(&quot;//*&quot;) != string::npos)
		{
			auslesen_TITE = &quot;TITE_&quot; + (buffer.substr(buffer.find('/')+3, (buffer.find('/')+3)+32));
				auslesen_INFO = &quot;INFO_&quot; + (buffer.substr(buffer.find('/')+3, (buffer.find('/')+3)+32));
				auslesen_NAME = &quot;NAME_&quot; + (buffer.substr(buffer.find('/')+3, (buffer.find('/')+3)+32));
				auslesen_DATA = &quot;DATA_&quot; + (buffer.substr(buffer.find('/')+3, (buffer.find('/')+3)+32));

				cout &lt;&lt; auslesen_INFO;
			}
		}
		file.close();
}
</code></pre>
<p>auslesen_INFO ist in der base_info.h #define.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/847983</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/847983</guid><dc:creator><![CDATA[localhost]]></dc:creator><pubDate>Mon, 08 Aug 2005 13:25:00 GMT</pubDate></item><item><title><![CDATA[Reply to String engabe als #define on Mon, 08 Aug 2005 13:51:35 GMT]]></title><description><![CDATA[<p>Hi,</p>
<p>denk daran dass macros zur compilezeit ausgewertet bzw. ersetzt werden. Wenn dein program läuft kannst die nicht mehr zusammenbasteln weil der compiler die dann nicht sieht.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/848017</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/848017</guid><dc:creator><![CDATA[prolog]]></dc:creator><pubDate>Mon, 08 Aug 2005 13:51:35 GMT</pubDate></item><item><title><![CDATA[Reply to String engabe als #define on Mon, 08 Aug 2005 14:26:10 GMT]]></title><description><![CDATA[<p>prolog schrieb:</p>
<blockquote>
<p>Hi,</p>
<p>denk daran dass macros zur compilezeit ausgewertet bzw. ersetzt werden. Wenn dein program läuft kannst die nicht mehr zusammenbasteln weil der compiler die dann nicht sieht.</p>
</blockquote>
<p>häää</p>
<p>kann ich jetzt den string nicht als magro ausgeben ??</p>
]]></description><link>https://www.c-plusplus.net/forum/post/848057</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/848057</guid><dc:creator><![CDATA[localhost]]></dc:creator><pubDate>Mon, 08 Aug 2005 14:26:10 GMT</pubDate></item><item><title><![CDATA[Reply to String engabe als #define on Mon, 08 Aug 2005 14:28:43 GMT]]></title><description><![CDATA[<p>Hi,</p>
<p>Du kannst den wert ausgeben. Vielleicht versteh ich dich auch falsch.</p>
<p>Für mich sieht es so aus als wolltest du die macros zur laufzeit zusammenbasteln also die namen der macros meine ich und dann erwarten dass du den wert der macros in einem string speichern kannst. Wenn dem nicht so ist, vergiss meinen<br />
post.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/848061</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/848061</guid><dc:creator><![CDATA[prolog]]></dc:creator><pubDate>Mon, 08 Aug 2005 14:28:43 GMT</pubDate></item><item><title><![CDATA[Reply to String engabe als #define on Mon, 08 Aug 2005 14:31:51 GMT]]></title><description><![CDATA[<p>ich weiss nicht was das soll, du definierts da<br />
konstanten und wenn du auf sie zugreifen willst schliesst du sie in &quot;&quot; ein,<br />
dann wird das auch so interpretiert als wenn das normaler text,<br />
das heisst die auflösung des wertes deiner konstanten erfolgt erst gar nicht,<br />
weil der compiler eben gar net weisst dass du den wert der konstanten abfragen willst<br />
oder?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/848067</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/848067</guid><dc:creator><![CDATA[rene1]]></dc:creator><pubDate>Mon, 08 Aug 2005 14:31:51 GMT</pubDate></item><item><title><![CDATA[Reply to String engabe als #define on Mon, 08 Aug 2005 14:35:21 GMT]]></title><description><![CDATA[<p>mit dem file code suche ich alle magross<br />
die werden dan ausgegeben die<br />
00000000000000000000000000000001<br />
bis<br />
99999999999999999999999999999999</p>
<p>und dan hänge ich einfach das NAME_ oder TITE_ vornen dran.<br />
aber dan habe ich z.b.<br />
INFO_00000000000000000000000000000001 in einen string und will das in einen magro ausgeben.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/848073</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/848073</guid><dc:creator><![CDATA[localhost]]></dc:creator><pubDate>Mon, 08 Aug 2005 14:35:21 GMT</pubDate></item><item><title><![CDATA[Reply to String engabe als #define on Mon, 08 Aug 2005 14:39:07 GMT]]></title><description><![CDATA[<p>Ja,</p>
<p>dann hab ich dich doch richtig verstanden. Geht so aber nicht weil macros zur compilezeit also in dem moment wo du dein program kompilierst ersetzt werden. Wenn dein programm läuft ist das schon alles passiert. Du musst das also anders lösen.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/848076</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/848076</guid><dc:creator><![CDATA[prolog]]></dc:creator><pubDate>Mon, 08 Aug 2005 14:39:07 GMT</pubDate></item><item><title><![CDATA[Reply to String engabe als #define on Mon, 08 Aug 2005 14:42:04 GMT]]></title><description><![CDATA[<p>hatt da jemand eine idee?<br />
Wie geht den sowas in cpp<br />
das ist jetzt php</p>
<p>array(<br />
&quot;titel&quot; =&gt; &quot;000000000000000000000000001&quot;,<br />
&quot;titel2&quot; =&gt; &quot;000000000000000000000000002&quot;,<br />
usw<br />
)</p>
]]></description><link>https://www.c-plusplus.net/forum/post/848078</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/848078</guid><dc:creator><![CDATA[localhost]]></dc:creator><pubDate>Mon, 08 Aug 2005 14:42:04 GMT</pubDate></item><item><title><![CDATA[Reply to String engabe als #define on Mon, 08 Aug 2005 14:46:16 GMT]]></title><description><![CDATA[<p>std::map<a href="std::string,std::string" rel="nofollow">std::string,std::string</a> code_table;<br />
wobei der erste string den titel und der 2te den code enthät.<br />
//edit<br />
alternativ könntest du auch<br />
nen std::set&lt;std::pair<a href="std::string,std::string" rel="nofollow">std::string,std::string</a> &gt; code_table; nehmen...</p>
]]></description><link>https://www.c-plusplus.net/forum/post/848081</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/848081</guid><dc:creator><![CDATA[shapeless]]></dc:creator><pubDate>Mon, 08 Aug 2005 14:46:16 GMT</pubDate></item><item><title><![CDATA[Reply to String engabe als #define on Mon, 08 Aug 2005 14:46:35 GMT]]></title><description><![CDATA[<p>Hi,</p>
<p>das geht zum beispiel mit einer map.</p>
<pre><code class="language-cpp">#include &lt;iostream&gt;
#include &lt;string&gt;
#include &lt;map&gt;

int main(){
   std::map&lt;std::string,std::string&gt; m;

   m[&quot;foo&quot;]=&quot;bar&quot;;

   std::cout&lt;&lt;m[&quot;foo&quot;]&lt;&lt;std::endl;

}
</code></pre>
<p>Ausgabe:</p>
<blockquote>
<p>bar</p>
</blockquote>
<p>So far ..</p>
]]></description><link>https://www.c-plusplus.net/forum/post/848086</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/848086</guid><dc:creator><![CDATA[prolog]]></dc:creator><pubDate>Mon, 08 Aug 2005 14:46:35 GMT</pubDate></item><item><title><![CDATA[Reply to String engabe als #define on Wed, 10 Aug 2005 15:37:19 GMT]]></title><description><![CDATA[<p>das was du da in php machst nennt sich wertzuweisung eines<br />
assoziativen arrays, unter dem stichwort solltest du eigentlich<br />
etwas finden können <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f609.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--winking_face"
      title=";-)"
      alt="😉"
    /></p>
]]></description><link>https://www.c-plusplus.net/forum/post/849576</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/849576</guid><dc:creator><![CDATA[rene1]]></dc:creator><pubDate>Wed, 10 Aug 2005 15:37:19 GMT</pubDate></item></channel></rss>