<?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[stream operator &amp;gt;&amp;gt; mit anderen Zeichen als whitespace?]]></title><description><![CDATA[<p>Hallo,</p>
<p>ich sehe nur skipws und noskipws als Modifikatoren für &lt;&lt; und &gt;&gt; Operatoren, aber gibt es auch eine Möglichkeit, den Extraction Operator so umzubiegen, dass er andere Delimiter anstelle von whitespaces nimmt? Oder muss ich mir so einen Tokenizer selber schreiben?</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/286818/stream-operator-gt-gt-mit-anderen-zeichen-als-whitespace</link><generator>RSS for Node</generator><lastBuildDate>Thu, 20 Aug 2026 17:24:55 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/286818.rss" rel="self" type="application/rss+xml"/><pubDate>Tue, 17 May 2011 06:43:03 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to stream operator &amp;gt;&amp;gt; mit anderen Zeichen als whitespace? on Tue, 17 May 2011 06:43:03 GMT]]></title><description><![CDATA[<p>Hallo,</p>
<p>ich sehe nur skipws und noskipws als Modifikatoren für &lt;&lt; und &gt;&gt; Operatoren, aber gibt es auch eine Möglichkeit, den Extraction Operator so umzubiegen, dass er andere Delimiter anstelle von whitespaces nimmt? Oder muss ich mir so einen Tokenizer selber schreiben?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2064399</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2064399</guid><dc:creator><![CDATA[Seikilos]]></dc:creator><pubDate>Tue, 17 May 2011 06:43:03 GMT</pubDate></item><item><title><![CDATA[Reply to stream operator &amp;gt;&amp;gt; mit anderen Zeichen als whitespace? on Tue, 17 May 2011 07:09:51 GMT]]></title><description><![CDATA[<p>Mir ist keine Möglichkeit bekannt, soweit ich weiß gibt es auch keine.</p>
<p>Ich würde mir eine eigene Klasse schreiben und für diese mit dann den entsprechenden Operator überladen. Dann kannst dir das ja selber zusammenbasteln.</p>
<p>Lg freeG</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2064409</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2064409</guid><dc:creator><![CDATA[fr33g]]></dc:creator><pubDate>Tue, 17 May 2011 07:09:51 GMT</pubDate></item><item><title><![CDATA[Reply to stream operator &amp;gt;&amp;gt; mit anderen Zeichen als whitespace? on Tue, 17 May 2011 07:12:31 GMT]]></title><description><![CDATA[<p>Bei std::getline (aus &lt;string&gt;) kannst du z.B. eine beliebigen delimiter angeben.<br />
Ansonsten kannst du das Verhalten der streams mit locale-Objekten und facets modifizieren. Aber frag mich nicht wie das geht. Möglich ist es grundsätzlich.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2064410</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2064410</guid><dc:creator><![CDATA[__Stefan__]]></dc:creator><pubDate>Tue, 17 May 2011 07:12:31 GMT</pubDate></item><item><title><![CDATA[Reply to stream operator &amp;gt;&amp;gt; mit anderen Zeichen als whitespace? on Tue, 17 May 2011 11:47:32 GMT]]></title><description><![CDATA[<p>(quelle: Tom Usenet / microsoft.public.vc.stl)</p>
<pre><code class="language-cpp">#include &lt;locale&gt; 
#include &lt;string&gt; 

class space_ctype: public std::ctype&lt;char&gt; 
{ 
public: 
 space_ctype(std::string const&amp; whitespaces):std::ctype&lt;char&gt;(get_mask(whitespaces), true) { 
  }; 
private: 
 static mask const* get_mask(std::string const&amp; whitespaces) 
 { 
  mask* m = new mask[table_size]; 
  mask const* classic =std::ctype&lt;char&gt;::classic_table(); 

  for (size_t j = 0; j &lt; table_size; ++j){ 
   m[j] = (mask)(classic[j] &amp; ~space); 
  } 
  for(std::string::const_iterator i = whitespaces.begin(), end = whitespaces.end(); i != end; ++i){ 
   m[static_cast&lt;unsigned char&gt;(*i)] =  (mask)(m[static_cast&lt;unsigned 
char&gt;(*i)] | space); 
  } 
  return m; 
 } 
}; 

static std::locale loc_space(std::locale(&quot;C&quot;), new space_ctype(&quot;&quot;)); // kein space zeichen! 
std::cin.imbue(loc_space); 
std::string parser_string; 
std::cin &gt;&gt; parser_string;
</code></pre>
<p>Wenn man die ganze Klassen deklaration von &quot;space_ctype&quot; in ein H-File<br />
auslagert dann ist das ganze auch nicht mehr so unhandlich!</p>
<p>PS:<br />
mit wchar als template argumnet des streams geht es anders. vgl.:<br />
<a href="http://stackoverflow.com/questions/2339593/overriding-ctypewchar-t" rel="nofollow">http://stackoverflow.com/questions/2339593/overriding-ctypewchar-t</a></p>
]]></description><link>https://www.c-plusplus.net/forum/post/2064574</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2064574</guid><dc:creator><![CDATA[Drehleiter]]></dc:creator><pubDate>Tue, 17 May 2011 11:47:32 GMT</pubDate></item><item><title><![CDATA[Reply to stream operator &amp;gt;&amp;gt; mit anderen Zeichen als whitespace? on Tue, 17 May 2011 12:20:14 GMT]]></title><description><![CDATA[<p>siehe auch <a href="http://www.c-plusplus.net/forum/285373" rel="nofollow">http://www.c-plusplus.net/forum/285373</a></p>
]]></description><link>https://www.c-plusplus.net/forum/post/2064606</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2064606</guid><dc:creator><![CDATA[Braunstein]]></dc:creator><pubDate>Tue, 17 May 2011 12:20:14 GMT</pubDate></item></channel></rss>