<?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[Daten richtig vergleichen String mit int?]]></title><description><![CDATA[<p>Hallo,</p>
<p>hier ist erstmals mein Programm:</p>
<pre><code>#include &lt;iostream&gt;
#include &lt;fstream&gt;
#include &lt;string&gt;

using namespace std;

int main() {

	// Text-Wiedergaben
	/* Verschiedene Ausgaben */

	string discription = &quot;Das Text-File muss sind im Hauptordner des Programmes befinden...!&quot;;
	string leerzeile = &quot; &quot;;
	string start = &quot;Drücke eine Taste um die Config zu checken...&quot;;
	string beenden = &quot;Druecke eine Taste um das Programm zu beenden!&quot;;

	/* Hauptdateien */
	string cl_movespeedkeyt = &quot;cl_movespeedkey(0.52) wurde gefunden!&quot;;
	string cl_movespeedkeyf = &quot;cl_movespeedkey(0.52) wurde nicht gefunden!&quot;;

	string cl_pitchspeedt = &quot;cl_pitchspeed(255) wurde gefunden!&quot;;
	string cl_pitchspeedf = &quot;cl_pitchspeed(255) wurde nicht gefunden!&quot;;

	string cl_showeventst = &quot;cl_showevents(0) wurde gefunden!&quot;;
	string cl_showeventsf = &quot;cl_showevents(0) wurde nicht gefunden!&quot;;

	string cl_pmanstatst = &quot;cl_pmanstats(0) wurde gefunden!&quot;;
	string cl_pmanstatsf = &quot;cl_pmanstats(0) wurde nicht gefunden!&quot;;

	string cl_lct = &quot;cl_lc(1) wurde gefunden!&quot;;
	string cl_lcf = &quot;cl_lc(1) wurde nicht gefunden!&quot;;

	string cl_lwt = &quot;cl_lw(1) wurde gefunden!&quot;;
	string cl_lwf = &quot;cl_lw(1) wurde nicht gefunden!&quot;;

	string d_spriteskipt = &quot;d_spriteskip(0) wurde gefunden!&quot;;
	string d_spriteskipf = &quot;d_spriteskip(0) wurde nicht gefunden!&quot;;

	string gl_monolightst = &quot;gl_monolights(0) wurde gefunden!&quot;;
	string gl_monolightsf = &quot;gl_monolights(0) wurde nicht gefunden!&quot;;

	string gl_picmipt = &quot;gl_picmip(0) wurde gefunden!&quot;;
	string gl_picmipf = &quot;gl_picmip(0) wurde nicht gefunden!&quot;;

	string gl_polyoffsett = &quot;gl_polyoffset(0) wurde gefunden!&quot;;
	string gl_polyoffsetf = &quot;gl_polyoffset(0) wurde nicht gefunden!&quot;;

	string s_showt = &quot;s_show(0) wurde gefunden!&quot;;
	string s_showf = &quot;s_show(0) wurde nicht gefunden!&quot;;

	string s_a3dt = &quot;s_a3d(0) wurde gefunden!&quot;;
	string s_a3df = &quot;s_a3d(0) wurde nicht gefunden!&quot;;

	string lightgammat = &quot;lightgamma(2.5) wurde gefunden!&quot;;
	string lightgammaf = &quot;lightgamma(2.5) wurde nicht gefunden!&quot;;

	string texgammat = &quot;texgamma(2.0) wurde gefunden!&quot;;
	string texgammaf = &quot;texgamma(2.0) wurde nicht gefunden!&quot;;

	string net_grapht = &quot;net_graph(0) wurde gefunden!&quot;;
	string net_graphf = &quot;net_graph(0) wurde nicht gefunden!&quot;;

	string cl_showerrort = &quot;cl_showerror(0) wurde gefunden!&quot;;
	string cl_showerrorf = &quot;cl_showerror(0) wurde nicht gefunden!&quot;;

	// Programm START

	cout &lt;&lt; discription &lt;&lt; endl;
	cout &lt;&lt; leerzeile &lt;&lt; endl;
	cout &lt;&lt; start &lt;&lt; endl;
	cin.get();

	// File Einlesen
	ifstream file(&quot;c:\\testfile.txt&quot;);

	// Search-Function
	string line;
	while(getline(file,line)) { 

		// cl_movespeedkey
		if(line.find(&quot;cl_movespeedkey&quot;) != string::npos) {
			cout &lt;&lt; cl_movespeedkeyt &lt;&lt; endl;
		}

			else {
				cout &lt;&lt; cl_movespeedkeyf &lt;&lt; endl;
			}

		// cl_pitchspeed
		if(line.find(&quot;cl_pitchspeed&quot;) != string::npos) {
			cout &lt;&lt; cl_pitchspeedt &lt;&lt; endl;
		}

			else {
				cout &lt;&lt; cl_pitchspeedf &lt;&lt; endl;
			}

		// cl_showevents
		if(line.find(&quot;cl_showevents&quot;) != string::npos) {
			cout &lt;&lt; cl_showeventst &lt;&lt; endl;
		}

			else {
				cout &lt;&lt; cl_showeventsf &lt;&lt; endl;
			}

		// cl_pmanstats
		if(line.find(&quot;cl_pmanstats&quot;) != string::npos) {
			cout &lt;&lt; cl_pmanstatst &lt;&lt; endl;
		}

			else {
				cout &lt;&lt; cl_pmanstatsf &lt;&lt; endl;
			}

		// cl_lc
		if(line.find(&quot;cl_lc&quot;) != string::npos) {
			cout &lt;&lt; cl_lct &lt;&lt; endl;
		}

			else {
				cout &lt;&lt; cl_lcf &lt;&lt; endl;
			}

		// cl_lw
		if(line.find(&quot;cl_lw&quot;) != string::npos) {
			cout &lt;&lt; cl_lwt &lt;&lt; endl;
		}

			else {
				cout &lt;&lt; cl_lwf &lt;&lt; endl;
			}

		// d_spriteskip
		if(line.find(&quot;d_spriteskip&quot;) != string::npos) {
			cout &lt;&lt; d_spriteskipt &lt;&lt; endl;
		}

			else {
				cout &lt;&lt; d_spriteskipf &lt;&lt; endl;
			}

		// gl_monolights
		if(line.find(&quot;cl_pitchspeed&quot;) != string::npos) {
			cout &lt;&lt; gl_monolightst &lt;&lt; endl;
		}

			else {
				cout &lt;&lt; gl_monolightsf &lt;&lt; endl;
			}

		// gl_picmip
		if(line.find(&quot;gl_picmip&quot;) != string::npos) {
			cout &lt;&lt; gl_picmipt &lt;&lt; endl;
		}

			else {
				cout &lt;&lt; gl_picmipf &lt;&lt; endl;
			}

		// gl_polyoffset
		if(line.find(&quot;gl_polyoffset&quot;) != string::npos) {
			cout &lt;&lt; gl_polyoffsett &lt;&lt; endl;
		}

			else {
				cout &lt;&lt; gl_polyoffsetf &lt;&lt; endl;
			}

		// s_show
		if(line.find(&quot;s_show&quot;) != string::npos) {
			cout &lt;&lt; s_showt &lt;&lt; endl;
		}

			else {
				cout &lt;&lt; s_showf &lt;&lt; endl;
			}

		// s_a3d
		if(line.find(&quot;s_a3d&quot;) != string::npos) {
			cout &lt;&lt; s_a3dt &lt;&lt; endl;
		}

			else {
				cout &lt;&lt; s_a3df &lt;&lt; endl;
			}

		// lightgamma
		if(line.find(&quot;lightgamma&quot;) != string::npos) {
			cout &lt;&lt; lightgammat &lt;&lt; endl;
		}

			else {
				cout &lt;&lt; lightgammaf &lt;&lt; endl;
			}

		// texgamma
		if(line.find(&quot;texgamma&quot;) != string::npos) {
			cout &lt;&lt; texgammat &lt;&lt; endl;
		}

			else {
				cout &lt;&lt; texgammaf &lt;&lt; endl;
			}

		// net_graph
		if(line.find(&quot;net_graph&quot;) != string::npos) {
			cout &lt;&lt; net_grapht &lt;&lt; endl;
		}

			else {
				cout &lt;&lt; net_graphf &lt;&lt; endl;
			}

		// cl_showerror
		if(line.find(&quot;cl_showerror&quot;) != string::npos) {
			cout &lt;&lt; cl_showerrort &lt;&lt; endl;
		}

			else {
				cout &lt;&lt; cl_showerrorf &lt;&lt; endl;
			}

	}

	//Programm Beenden
	cout &lt;&lt; leerzeile &lt;&lt; endl;
	cout &lt;&lt; beenden &lt;&lt; endl;
	cin.get();
	//system(&quot;PAUSE&quot;);
	return 0;
}
</code></pre>
<p>Also was soll mein Programm machen?<br />
Es soll Werte in einer Textdatei überprüfen ob die stimmen wie ich sie vorgebe.<br />
Zum Beispiel soll cl_movespeedkey den Wert 0.52 bekommen, da es ja ein Int ist,<br />
weiß ich nicht, wie ich den Wert in meine Funktion mit einbauen soll. Weil<br />
das geht ja nicht:</p>
<pre><code>// cl_movespeedkey
		if(line.find(&quot;cl_movespeedkey 0.52&quot;) != string::npos) {
			cout &lt;&lt; cl_movespeedkeyt &lt;&lt; endl;
		}

			else {
				cout &lt;&lt; cl_movespeedkeyf &lt;&lt; endl;
			}
</code></pre>
<p>In der Textdatei steht das so: cl_movespeedkey &quot;0.52&quot;, dass kann es dann ja<br />
natürlich nicht finden.</p>
<p>Weiß einer eine Lösung?</p>
<p>MfG</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/270514/daten-richtig-vergleichen-string-mit-int</link><generator>RSS for Node</generator><lastBuildDate>Sun, 30 Aug 2026 01:15:45 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/270514.rss" rel="self" type="application/rss+xml"/><pubDate>Tue, 13 Jul 2010 22:12:57 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Daten richtig vergleichen String mit int? on Tue, 13 Jul 2010 22:12:57 GMT]]></title><description><![CDATA[<p>Hallo,</p>
<p>hier ist erstmals mein Programm:</p>
<pre><code>#include &lt;iostream&gt;
#include &lt;fstream&gt;
#include &lt;string&gt;

using namespace std;

int main() {

	// Text-Wiedergaben
	/* Verschiedene Ausgaben */

	string discription = &quot;Das Text-File muss sind im Hauptordner des Programmes befinden...!&quot;;
	string leerzeile = &quot; &quot;;
	string start = &quot;Drücke eine Taste um die Config zu checken...&quot;;
	string beenden = &quot;Druecke eine Taste um das Programm zu beenden!&quot;;

	/* Hauptdateien */
	string cl_movespeedkeyt = &quot;cl_movespeedkey(0.52) wurde gefunden!&quot;;
	string cl_movespeedkeyf = &quot;cl_movespeedkey(0.52) wurde nicht gefunden!&quot;;

	string cl_pitchspeedt = &quot;cl_pitchspeed(255) wurde gefunden!&quot;;
	string cl_pitchspeedf = &quot;cl_pitchspeed(255) wurde nicht gefunden!&quot;;

	string cl_showeventst = &quot;cl_showevents(0) wurde gefunden!&quot;;
	string cl_showeventsf = &quot;cl_showevents(0) wurde nicht gefunden!&quot;;

	string cl_pmanstatst = &quot;cl_pmanstats(0) wurde gefunden!&quot;;
	string cl_pmanstatsf = &quot;cl_pmanstats(0) wurde nicht gefunden!&quot;;

	string cl_lct = &quot;cl_lc(1) wurde gefunden!&quot;;
	string cl_lcf = &quot;cl_lc(1) wurde nicht gefunden!&quot;;

	string cl_lwt = &quot;cl_lw(1) wurde gefunden!&quot;;
	string cl_lwf = &quot;cl_lw(1) wurde nicht gefunden!&quot;;

	string d_spriteskipt = &quot;d_spriteskip(0) wurde gefunden!&quot;;
	string d_spriteskipf = &quot;d_spriteskip(0) wurde nicht gefunden!&quot;;

	string gl_monolightst = &quot;gl_monolights(0) wurde gefunden!&quot;;
	string gl_monolightsf = &quot;gl_monolights(0) wurde nicht gefunden!&quot;;

	string gl_picmipt = &quot;gl_picmip(0) wurde gefunden!&quot;;
	string gl_picmipf = &quot;gl_picmip(0) wurde nicht gefunden!&quot;;

	string gl_polyoffsett = &quot;gl_polyoffset(0) wurde gefunden!&quot;;
	string gl_polyoffsetf = &quot;gl_polyoffset(0) wurde nicht gefunden!&quot;;

	string s_showt = &quot;s_show(0) wurde gefunden!&quot;;
	string s_showf = &quot;s_show(0) wurde nicht gefunden!&quot;;

	string s_a3dt = &quot;s_a3d(0) wurde gefunden!&quot;;
	string s_a3df = &quot;s_a3d(0) wurde nicht gefunden!&quot;;

	string lightgammat = &quot;lightgamma(2.5) wurde gefunden!&quot;;
	string lightgammaf = &quot;lightgamma(2.5) wurde nicht gefunden!&quot;;

	string texgammat = &quot;texgamma(2.0) wurde gefunden!&quot;;
	string texgammaf = &quot;texgamma(2.0) wurde nicht gefunden!&quot;;

	string net_grapht = &quot;net_graph(0) wurde gefunden!&quot;;
	string net_graphf = &quot;net_graph(0) wurde nicht gefunden!&quot;;

	string cl_showerrort = &quot;cl_showerror(0) wurde gefunden!&quot;;
	string cl_showerrorf = &quot;cl_showerror(0) wurde nicht gefunden!&quot;;

	// Programm START

	cout &lt;&lt; discription &lt;&lt; endl;
	cout &lt;&lt; leerzeile &lt;&lt; endl;
	cout &lt;&lt; start &lt;&lt; endl;
	cin.get();

	// File Einlesen
	ifstream file(&quot;c:\\testfile.txt&quot;);

	// Search-Function
	string line;
	while(getline(file,line)) { 

		// cl_movespeedkey
		if(line.find(&quot;cl_movespeedkey&quot;) != string::npos) {
			cout &lt;&lt; cl_movespeedkeyt &lt;&lt; endl;
		}

			else {
				cout &lt;&lt; cl_movespeedkeyf &lt;&lt; endl;
			}

		// cl_pitchspeed
		if(line.find(&quot;cl_pitchspeed&quot;) != string::npos) {
			cout &lt;&lt; cl_pitchspeedt &lt;&lt; endl;
		}

			else {
				cout &lt;&lt; cl_pitchspeedf &lt;&lt; endl;
			}

		// cl_showevents
		if(line.find(&quot;cl_showevents&quot;) != string::npos) {
			cout &lt;&lt; cl_showeventst &lt;&lt; endl;
		}

			else {
				cout &lt;&lt; cl_showeventsf &lt;&lt; endl;
			}

		// cl_pmanstats
		if(line.find(&quot;cl_pmanstats&quot;) != string::npos) {
			cout &lt;&lt; cl_pmanstatst &lt;&lt; endl;
		}

			else {
				cout &lt;&lt; cl_pmanstatsf &lt;&lt; endl;
			}

		// cl_lc
		if(line.find(&quot;cl_lc&quot;) != string::npos) {
			cout &lt;&lt; cl_lct &lt;&lt; endl;
		}

			else {
				cout &lt;&lt; cl_lcf &lt;&lt; endl;
			}

		// cl_lw
		if(line.find(&quot;cl_lw&quot;) != string::npos) {
			cout &lt;&lt; cl_lwt &lt;&lt; endl;
		}

			else {
				cout &lt;&lt; cl_lwf &lt;&lt; endl;
			}

		// d_spriteskip
		if(line.find(&quot;d_spriteskip&quot;) != string::npos) {
			cout &lt;&lt; d_spriteskipt &lt;&lt; endl;
		}

			else {
				cout &lt;&lt; d_spriteskipf &lt;&lt; endl;
			}

		// gl_monolights
		if(line.find(&quot;cl_pitchspeed&quot;) != string::npos) {
			cout &lt;&lt; gl_monolightst &lt;&lt; endl;
		}

			else {
				cout &lt;&lt; gl_monolightsf &lt;&lt; endl;
			}

		// gl_picmip
		if(line.find(&quot;gl_picmip&quot;) != string::npos) {
			cout &lt;&lt; gl_picmipt &lt;&lt; endl;
		}

			else {
				cout &lt;&lt; gl_picmipf &lt;&lt; endl;
			}

		// gl_polyoffset
		if(line.find(&quot;gl_polyoffset&quot;) != string::npos) {
			cout &lt;&lt; gl_polyoffsett &lt;&lt; endl;
		}

			else {
				cout &lt;&lt; gl_polyoffsetf &lt;&lt; endl;
			}

		// s_show
		if(line.find(&quot;s_show&quot;) != string::npos) {
			cout &lt;&lt; s_showt &lt;&lt; endl;
		}

			else {
				cout &lt;&lt; s_showf &lt;&lt; endl;
			}

		// s_a3d
		if(line.find(&quot;s_a3d&quot;) != string::npos) {
			cout &lt;&lt; s_a3dt &lt;&lt; endl;
		}

			else {
				cout &lt;&lt; s_a3df &lt;&lt; endl;
			}

		// lightgamma
		if(line.find(&quot;lightgamma&quot;) != string::npos) {
			cout &lt;&lt; lightgammat &lt;&lt; endl;
		}

			else {
				cout &lt;&lt; lightgammaf &lt;&lt; endl;
			}

		// texgamma
		if(line.find(&quot;texgamma&quot;) != string::npos) {
			cout &lt;&lt; texgammat &lt;&lt; endl;
		}

			else {
				cout &lt;&lt; texgammaf &lt;&lt; endl;
			}

		// net_graph
		if(line.find(&quot;net_graph&quot;) != string::npos) {
			cout &lt;&lt; net_grapht &lt;&lt; endl;
		}

			else {
				cout &lt;&lt; net_graphf &lt;&lt; endl;
			}

		// cl_showerror
		if(line.find(&quot;cl_showerror&quot;) != string::npos) {
			cout &lt;&lt; cl_showerrort &lt;&lt; endl;
		}

			else {
				cout &lt;&lt; cl_showerrorf &lt;&lt; endl;
			}

	}

	//Programm Beenden
	cout &lt;&lt; leerzeile &lt;&lt; endl;
	cout &lt;&lt; beenden &lt;&lt; endl;
	cin.get();
	//system(&quot;PAUSE&quot;);
	return 0;
}
</code></pre>
<p>Also was soll mein Programm machen?<br />
Es soll Werte in einer Textdatei überprüfen ob die stimmen wie ich sie vorgebe.<br />
Zum Beispiel soll cl_movespeedkey den Wert 0.52 bekommen, da es ja ein Int ist,<br />
weiß ich nicht, wie ich den Wert in meine Funktion mit einbauen soll. Weil<br />
das geht ja nicht:</p>
<pre><code>// cl_movespeedkey
		if(line.find(&quot;cl_movespeedkey 0.52&quot;) != string::npos) {
			cout &lt;&lt; cl_movespeedkeyt &lt;&lt; endl;
		}

			else {
				cout &lt;&lt; cl_movespeedkeyf &lt;&lt; endl;
			}
</code></pre>
<p>In der Textdatei steht das so: cl_movespeedkey &quot;0.52&quot;, dass kann es dann ja<br />
natürlich nicht finden.</p>
<p>Weiß einer eine Lösung?</p>
<p>MfG</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1925866</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1925866</guid><dc:creator><![CDATA[darvis]]></dc:creator><pubDate>Tue, 13 Jul 2010 22:12:57 GMT</pubDate></item><item><title><![CDATA[Reply to Daten richtig vergleichen String mit int? on Tue, 13 Jul 2010 22:25:20 GMT]]></title><description><![CDATA[<p>Ich verstehe die Frage nicht</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1925870</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1925870</guid><dc:creator><![CDATA[TyRoXx]]></dc:creator><pubDate>Tue, 13 Jul 2010 22:25:20 GMT</pubDate></item><item><title><![CDATA[Reply to Daten richtig vergleichen String mit int? on Tue, 13 Jul 2010 23:37:04 GMT]]></title><description><![CDATA[<p>Ich möchte ein Programm machen, dass Werte in einer Textdatei vergleicht.</p>
<p>Das Problem ist, dass cl_movespeedkey &quot;0.52&quot; aus einem String und Int besteht.<br />
Ich weiß nicht, wie ich das in meiner Funktion mache das er nach cl_movespeedkey &quot;0.52&quot; sucht und nicht nur nach cl_movespeedkey.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1925890</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1925890</guid><dc:creator><![CDATA[darvis]]></dc:creator><pubDate>Tue, 13 Jul 2010 23:37:04 GMT</pubDate></item><item><title><![CDATA[Reply to Daten richtig vergleichen String mit int? on Wed, 14 Jul 2010 10:58:55 GMT]]></title><description><![CDATA[<p>Meinst du <code>&quot;cl_movespeedkey \&quot;0.52\&quot;&quot;</code> ?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1926076</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1926076</guid><dc:creator><![CDATA[TyRoXx]]></dc:creator><pubDate>Wed, 14 Jul 2010 10:58:55 GMT</pubDate></item><item><title><![CDATA[Reply to Daten richtig vergleichen String mit int? on Wed, 14 Jul 2010 11:00:20 GMT]]></title><description><![CDATA[<p>Ja das mit dem /&quot;0.52/&quot;&quot; ist auch gut zu wissen, nur weiß ich nicht wie ich aus dem 0.52 ein string mache</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1926079</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1926079</guid><dc:creator><![CDATA[darvis]]></dc:creator><pubDate>Wed, 14 Jul 2010 11:00:20 GMT</pubDate></item><item><title><![CDATA[Reply to Daten richtig vergleichen String mit int? on Wed, 14 Jul 2010 11:04:03 GMT]]></title><description><![CDATA[<p><a href="http://www.lmgtfy.com/?q=c%2B%2B+double+to+string" rel="nofollow">http://www.lmgtfy.com/?q=c%2B%2B+double+to+string</a></p>
]]></description><link>https://www.c-plusplus.net/forum/post/1926083</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1926083</guid><dc:creator><![CDATA[[[global:guest]]]]></dc:creator><pubDate>Wed, 14 Jul 2010 11:04:03 GMT</pubDate></item><item><title><![CDATA[Reply to Daten richtig vergleichen String mit int? on Wed, 14 Jul 2010 11:07:01 GMT]]></title><description><![CDATA[<p>So wie ich dich verstehe steht das in einer Datei, oder? Dann ist das doch ein String. Zahlenwerte kannst du nur in Binärdateien abspeichern, alles was du mit einem Editor lesen kannst, sind Strings.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1926085</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1926085</guid><dc:creator><![CDATA[Heimelchen]]></dc:creator><pubDate>Wed, 14 Jul 2010 11:07:01 GMT</pubDate></item><item><title><![CDATA[Reply to Daten richtig vergleichen String mit int? on Wed, 14 Jul 2010 11:48:00 GMT]]></title><description><![CDATA[<p>ah k, danke. werde ich gleich mal testen</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1926117</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1926117</guid><dc:creator><![CDATA[darvis]]></dc:creator><pubDate>Wed, 14 Jul 2010 11:48:00 GMT</pubDate></item><item><title><![CDATA[Reply to Daten richtig vergleichen String mit int? on Wed, 14 Jul 2010 21:58:07 GMT]]></title><description><![CDATA[<pre><code>// cl_movespeedkey
if(line.find(&quot;cl_movespeedkey \&quot;0.52\&quot;&quot;) != string::npos) {
	cout &lt;&lt; cl_movespeedkeyt &lt;&lt; endl;
}
</code></pre>
<p>geht, danke</p>
<p>UPDATE:</p>
<p>wie kann ich jetzt in mein Programm abfragen, ob der Wert 0.52 verändert wurde, wenn er nicht 0.52 entspricht, sondern 0.53 z.B ?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1926376</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1926376</guid><dc:creator><![CDATA[darvis]]></dc:creator><pubDate>Wed, 14 Jul 2010 21:58:07 GMT</pubDate></item><item><title><![CDATA[Reply to Daten richtig vergleichen String mit int? on Wed, 14 Jul 2010 22:52:00 GMT]]></title><description><![CDATA[<p>Also falls du den Wert hinter deinem Parameter nicht kennst,<br />
wirst du reguläre Ausdrücke brauchen oder du suchst nur nach dem<br />
Parameternamen und nimmst das, was darauf folgt als Wert.</p>
<p>Ich denke du suchst sowas in der Art</p>
<pre><code class="language-cpp">#include&lt;iostream&gt;
#include&lt;string&gt;

bool getValue(const std::string&amp; text, const std::string&amp; par, std::string&amp; parVal){
        size_t index1 = text.find(par);
        size_t parLength = par.size();
        if(index1 != std::string::npos) {
                size_t startSearch = index1+parLength+1;
                size_t index2 = text.find(&quot; &quot;, startSearch);
                if(index2 != std::string::npos){
                        parVal = text.substr(startSearch, index2-startSearch);
                }
                else{
                        parVal = text.substr(startSearch, text.size()-startSearch);
                }
                return true;
        }
        return false;
}

void check(const std::string&amp; text, const std::string&amp; par){
        std::string parValue;
        if(getValue(text, par, parValue)){
                std::cout &lt;&lt; par &lt;&lt; &quot;: \&quot;&quot; &lt;&lt; parValue  &lt;&lt; &quot;\&quot;&quot; &lt;&lt; std::endl;
        }
        else {
                std::cout &lt;&lt; par &lt;&lt; &quot; not found&quot; &lt;&lt; std::endl;
        }
}

void checkAll(const std::string&amp; text){
        std::cout &lt;&lt; text &lt;&lt; std::endl;
        check(text, &quot;cl_movespeedkey&quot;);
        check(text, &quot;cl_pitchspeed&quot;);
}

int main() {
        std::string text1(&quot;Dein Text enhält cl_movespeedkey 0.52 und cl_pitchspeed 0.53&quot;);
        std::string text2(&quot;Dein Text enhält cl_movespeedkey 0.51 und cl_pitchspeed 0.54&quot;);
        std::string text3(&quot;Hallo darvis&quot;);
        checkAll(text1);
        checkAll(text2);
        checkAll(text3);
        return 0;
}
</code></pre>
<p>Wenn du den String jetzt als double haben möchtest, dann klick meinen ersten Link an <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f644.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--face_with_rolling_eyes"
      title=":rolling_eyes:"
      alt="🙄"
    /></p>
]]></description><link>https://www.c-plusplus.net/forum/post/1926391</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1926391</guid><dc:creator><![CDATA[[[global:guest]]]]></dc:creator><pubDate>Wed, 14 Jul 2010 22:52:00 GMT</pubDate></item><item><title><![CDATA[Reply to Daten richtig vergleichen String mit int? on Fri, 16 Jul 2010 05:48:56 GMT]]></title><description><![CDATA[<p>sehr gut danke, aber welcher erste link?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1926985</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1926985</guid><dc:creator><![CDATA[darvis]]></dc:creator><pubDate>Fri, 16 Jul 2010 05:48:56 GMT</pubDate></item><item><title><![CDATA[Reply to Daten richtig vergleichen String mit int? on Fri, 16 Jul 2010 11:18:21 GMT]]></title><description><![CDATA[<p>...</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1926991</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1926991</guid><dc:creator><![CDATA[[[global:guest]]]]></dc:creator><pubDate>Fri, 16 Jul 2010 11:18:21 GMT</pubDate></item></channel></rss>