<?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[char-Vektor in CString umwandeln]]></title><description><![CDATA[<p>Hi!</p>
<p>Ich würd gern einen dynamischen char-Vektor in einen CString umwandeln. Weiß zufällig wer , wie das geht? <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f642.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--slightly_smiling_face"
      title=":)"
      alt="🙂"
    /></p>
<p>mfg enne</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/154048/char-vektor-in-cstring-umwandeln</link><generator>RSS for Node</generator><lastBuildDate>Fri, 24 Jul 2026 12:07:35 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/154048.rss" rel="self" type="application/rss+xml"/><pubDate>Mon, 24 Jul 2006 02:59:31 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to char-Vektor in CString umwandeln on Mon, 24 Jul 2006 02:59:31 GMT]]></title><description><![CDATA[<p>Hi!</p>
<p>Ich würd gern einen dynamischen char-Vektor in einen CString umwandeln. Weiß zufällig wer , wie das geht? <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f642.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--slightly_smiling_face"
      title=":)"
      alt="🙂"
    /></p>
<p>mfg enne</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1102863</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1102863</guid><dc:creator><![CDATA[enne87]]></dc:creator><pubDate>Mon, 24 Jul 2006 02:59:31 GMT</pubDate></item><item><title><![CDATA[Reply to char-Vektor in CString umwandeln on Mon, 24 Jul 2006 06:51:51 GMT]]></title><description><![CDATA[<p>in einer Schleife kannst einfach jedes Element des Vektore mit += an deinen String anfügen. Evtl davor schonmal die physikalische Länges Strings setzen</p>
<pre><code class="language-cpp">CString temp;
temp.Preallocate(vec.size());

vector&lt;char&gt;::iterator it;

for(it = vec.begin();it != vec.end();++it)
{
    temp += *it;
}
</code></pre>
<p>Kannst die Schleife natürlich auch mit dem STL-Algorithmus umsetzen.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1102890</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1102890</guid><dc:creator><![CDATA[Pellaeon]]></dc:creator><pubDate>Mon, 24 Jul 2006 06:51:51 GMT</pubDate></item><item><title><![CDATA[Reply to char-Vektor in CString umwandeln on Mon, 24 Jul 2006 11:31:08 GMT]]></title><description><![CDATA[<p>Ok, hat mir sehr geholfen, thx <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/1103071</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1103071</guid><dc:creator><![CDATA[enne87]]></dc:creator><pubDate>Mon, 24 Jul 2006 11:31:08 GMT</pubDate></item><item><title><![CDATA[Reply to char-Vektor in CString umwandeln on Mon, 24 Jul 2006 14:01:02 GMT]]></title><description><![CDATA[<p>Ich hätte da jetzt noch folgendes Problem:</p>
<p>Ich möchte in meiner Methode noch zusätzlich die Anzahl der Zeilen bestimmen. Das Problem ist nur, dass ich das Ende der Datei erreicht habe und ich es nicht schaffe, zum Anfang meiner Textdatei zurückzukehren.<br />
Hier der Code:</p>
<pre><code class="language-cpp">bool CWegmessung::GetText()
{	
   //Variable length mit irgendeinem Wert initialisieren
	int length = 1;
   //Textdatei zum Lesen öffnen
	ifstream textdatei(&quot;test.txt&quot;, ios::in);
	if(!textdatei)
	{
		TRACE(_T(&quot;Fehler beim Öffnen der Datei!&quot;));
		return 1;
	}

	//Länge der Textdatei bestimmen
	 textdatei.seekg (0, ios::end);
	 length = textdatei.tellg();
	 textdatei.seekg (0, ios::beg);

	//Neues Vektorobjekt anlegen
	 char *buffer = new char[length];
	 textdatei.read (buffer,length);

	//Bufferinhalt in CString-Objekt speichern
	 text = buffer;
	 TRACE(text);

	 int f = (int)textdatei.tellg();

	//Speichern der Zeilenanzahl
	 while(!textdatei.eof())
	 {
		 textdatei.getline(buffer, length);
		 this-&gt;linecounter++;
	 }

    //Schließen der Textdatei
	 textdatei.close();
	 delete buffer;
	 return 0;
}
</code></pre>
<p>Die while-Schleife wird nie aufgerufen, da ich mich bereits am Ende der Textdatei befinde. Gibts da ne Möglichkeit, zum Anfang zu kommen?</p>
<p>mfg enne</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1103193</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1103193</guid><dc:creator><![CDATA[enne87]]></dc:creator><pubDate>Mon, 24 Jul 2006 14:01:02 GMT</pubDate></item></channel></rss>