<?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[Kommt nur murks raus]]></title><description><![CDATA[<p>Hey ich mal wieder <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f615.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--confused_face"
      title=":/"
      alt="😕"
    /></p>
<p>Folgendes Problem:<br />
Bei mir kommt bei der Ausgabe (auf der Konsole) so ein komischer kram raus und ich versteh nicht wieso?</p>
<pre><code>Update Networkstat: 0x7fff740ce1a0
</code></pre>
<p>sysinfo.h</p>
<pre><code class="language-cpp">#include &lt;iostream&gt;

#ifndef SYSINFO_H
#define SYSINFO_H

namespace exsystem {
class SYSInfo {
public:
  void systemreboot();
  SYSInfo();
  ~SYSInfo();
  int getTotalram();
  void *getUpdateNetworkstat();
  const char *getSysname();
  const char *getRelease();
  const char *getNodename();
  const char *getMaschine();
private:
  int Totalram; 
  std::string UpdateNetworkstat;
  std::string SysnameInfo;
  std::string ReleaseInfo;
  std::string NodenameInfo;
  std::string MachineInfo;
};
}

#endif
</code></pre>
<p>sysinfo.cpp</p>
<pre><code class="language-cpp">#include &lt;cstdio&gt;
#include &lt;unistd.h&gt;
#include &lt;sys/types.h&gt;
#include &lt;sys/reboot.h&gt;
#include &lt;sys/sysinfo.h&gt;
#include &lt;sys/utsname.h&gt;
#include &lt;fstream&gt;
#include &lt;string&gt;

#include &quot;sysinfo.h&quot;

//#ifdef POSIX

namespace exsystem { 
int SYSInfo::getTotalram(){
  return Totalram;
}

void *SYSInfo::getUpdateNetworkstat(){ 
  std::ifstream UpdateNetworkstat(&quot;/proc/net/dev&quot;);
  return UpdateNetworkstat;
}

const char *SYSInfo::getSysname(){
  return SysnameInfo.c_str();
}

const char *SYSInfo::getRelease(){
  return ReleaseInfo.c_str();
}

const char *SYSInfo::getNodename(){
  return NodenameInfo.c_str();
}

const char *SYSInfo::getMaschine(){
  return MachineInfo.c_str();
}

SYSInfo::SYSInfo(){
  struct sysinfo *mysys = new struct sysinfo;
  struct utsname myInfo;
  if(sysinfo(mysys)!=-1){
    Totalram=mysys-&gt;totalram/1024;
  }
  if (uname(&amp;myInfo) != -1) {
    SysnameInfo=myInfo.sysname;
    ReleaseInfo=myInfo.release;
    NodenameInfo=myInfo.nodename;
    MachineInfo=myInfo.machine;
  }
}

SYSInfo::~SYSInfo(){
}
}

//#endif
</code></pre>
<p>sysinfo.cpp</p>
<pre><code class="language-cpp">#include &quot;../sysinfo.h&quot;

int main(){  
  exsystem::SYSInfo a; 
  std::cout &lt;&lt; &quot;Ram: &quot; &lt;&lt; a.getTotalram() &lt;&lt; std::endl; 
  std::cout &lt;&lt; &quot;Update Networkstat: &quot; &lt;&lt; a.getUpdateNetworkstat() &lt;&lt; std::endl;   
  std::cout &lt;&lt; &quot;System name: &quot; &lt;&lt; a.getSysname() &lt;&lt; std::endl;
  std::cout &lt;&lt; &quot;Release: &quot; &lt;&lt; a.getRelease() &lt;&lt; std::endl;  
  std::cout &lt;&lt; &quot;Nodename: &quot; &lt;&lt; a.getNodename() &lt;&lt; std::endl;  
  std::cout &lt;&lt; &quot;Maschine: &quot; &lt;&lt; a.getMaschine() &lt;&lt; std::endl;   
  return 0;
}
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/topic/307787/kommt-nur-murks-raus</link><generator>RSS for Node</generator><lastBuildDate>Thu, 06 Aug 2026 05:58:53 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/307787.rss" rel="self" type="application/rss+xml"/><pubDate>Wed, 05 Sep 2012 13:05:45 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Kommt nur murks raus on Wed, 05 Sep 2012 13:05:45 GMT]]></title><description><![CDATA[<p>Hey ich mal wieder <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f615.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--confused_face"
      title=":/"
      alt="😕"
    /></p>
<p>Folgendes Problem:<br />
Bei mir kommt bei der Ausgabe (auf der Konsole) so ein komischer kram raus und ich versteh nicht wieso?</p>
<pre><code>Update Networkstat: 0x7fff740ce1a0
</code></pre>
<p>sysinfo.h</p>
<pre><code class="language-cpp">#include &lt;iostream&gt;

#ifndef SYSINFO_H
#define SYSINFO_H

namespace exsystem {
class SYSInfo {
public:
  void systemreboot();
  SYSInfo();
  ~SYSInfo();
  int getTotalram();
  void *getUpdateNetworkstat();
  const char *getSysname();
  const char *getRelease();
  const char *getNodename();
  const char *getMaschine();
private:
  int Totalram; 
  std::string UpdateNetworkstat;
  std::string SysnameInfo;
  std::string ReleaseInfo;
  std::string NodenameInfo;
  std::string MachineInfo;
};
}

#endif
</code></pre>
<p>sysinfo.cpp</p>
<pre><code class="language-cpp">#include &lt;cstdio&gt;
#include &lt;unistd.h&gt;
#include &lt;sys/types.h&gt;
#include &lt;sys/reboot.h&gt;
#include &lt;sys/sysinfo.h&gt;
#include &lt;sys/utsname.h&gt;
#include &lt;fstream&gt;
#include &lt;string&gt;

#include &quot;sysinfo.h&quot;

//#ifdef POSIX

namespace exsystem { 
int SYSInfo::getTotalram(){
  return Totalram;
}

void *SYSInfo::getUpdateNetworkstat(){ 
  std::ifstream UpdateNetworkstat(&quot;/proc/net/dev&quot;);
  return UpdateNetworkstat;
}

const char *SYSInfo::getSysname(){
  return SysnameInfo.c_str();
}

const char *SYSInfo::getRelease(){
  return ReleaseInfo.c_str();
}

const char *SYSInfo::getNodename(){
  return NodenameInfo.c_str();
}

const char *SYSInfo::getMaschine(){
  return MachineInfo.c_str();
}

SYSInfo::SYSInfo(){
  struct sysinfo *mysys = new struct sysinfo;
  struct utsname myInfo;
  if(sysinfo(mysys)!=-1){
    Totalram=mysys-&gt;totalram/1024;
  }
  if (uname(&amp;myInfo) != -1) {
    SysnameInfo=myInfo.sysname;
    ReleaseInfo=myInfo.release;
    NodenameInfo=myInfo.nodename;
    MachineInfo=myInfo.machine;
  }
}

SYSInfo::~SYSInfo(){
}
}

//#endif
</code></pre>
<p>sysinfo.cpp</p>
<pre><code class="language-cpp">#include &quot;../sysinfo.h&quot;

int main(){  
  exsystem::SYSInfo a; 
  std::cout &lt;&lt; &quot;Ram: &quot; &lt;&lt; a.getTotalram() &lt;&lt; std::endl; 
  std::cout &lt;&lt; &quot;Update Networkstat: &quot; &lt;&lt; a.getUpdateNetworkstat() &lt;&lt; std::endl;   
  std::cout &lt;&lt; &quot;System name: &quot; &lt;&lt; a.getSysname() &lt;&lt; std::endl;
  std::cout &lt;&lt; &quot;Release: &quot; &lt;&lt; a.getRelease() &lt;&lt; std::endl;  
  std::cout &lt;&lt; &quot;Nodename: &quot; &lt;&lt; a.getNodename() &lt;&lt; std::endl;  
  std::cout &lt;&lt; &quot;Maschine: &quot; &lt;&lt; a.getMaschine() &lt;&lt; std::endl;   
  return 0;
}
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/2248708</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2248708</guid><dc:creator><![CDATA[Enno]]></dc:creator><pubDate>Wed, 05 Sep 2012 13:05:45 GMT</pubDate></item><item><title><![CDATA[Reply to Kommt nur murks raus on Wed, 05 Sep 2012 13:26:25 GMT]]></title><description><![CDATA[<p>enno schrieb:</p>
<blockquote>
<p>Bei mir kommt bei der Ausgabe (auf der Konsole) so ein komischer kram raus und ich versteh nicht wieso?</p>
</blockquote>
<p>Weil Du einen Zeiger (auf ein zu dem Zeitpunkt nicht mehr existierendes Objekt) ausgibst. Das ist eine Adresse.</p>
<p>Was glaubst z.B. hier zu tun?</p>
<pre><code class="language-cpp">void *SYSInfo::getUpdateNetworkstat(){
  std::ifstream UpdateNetworkstat(&quot;/proc/net/dev&quot;);
  return UpdateNetworkstat;
}
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/2248718</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2248718</guid><dc:creator><![CDATA[Tachyon]]></dc:creator><pubDate>Wed, 05 Sep 2012 13:26:25 GMT</pubDate></item><item><title><![CDATA[Reply to Kommt nur murks raus on Wed, 05 Sep 2012 13:24:45 GMT]]></title><description><![CDATA[<p>Das ist ja immer noch derselbe Müll wie gestern. Schau in den anderen Thread, was ich dir zu std::string gesagt habe. Und das mit dem Speicherloch gilt weiterhin!</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2248719</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2248719</guid><dc:creator><![CDATA[daddy_felix]]></dc:creator><pubDate>Wed, 05 Sep 2012 13:24:45 GMT</pubDate></item><item><title><![CDATA[Reply to Kommt nur murks raus on Wed, 05 Sep 2012 13:43:54 GMT]]></title><description><![CDATA[<p>@daddy<br />
tut mir leid ich weiß was du meinst und habes ja auch geändert ... allerdings soll ich das nicht ändern das wird hier so gemacht frag mich nicht warum ich hab kein plan!!</p>
<p><a class="plugin-mentions-user plugin-mentions-a" href="https://www.c-plusplus.net/forum/uid/4465">@Tachyon</a><br />
Ich wollte den kram den in dem Verzeichnis &quot;/proc/net/dev&quot; zurück geben ... geht das so nicht?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2248725</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2248725</guid><dc:creator><![CDATA[Enno]]></dc:creator><pubDate>Wed, 05 Sep 2012 13:43:54 GMT</pubDate></item><item><title><![CDATA[Reply to Kommt nur murks raus on Fri, 07 Sep 2012 12:02:44 GMT]]></title><description><![CDATA[<p>Enno schrieb:</p>
<blockquote>
<p>[cpp]<br />
const char *getMa<strong>sch</strong>ine();<br />
[...]<br />
std::string Ma<strong>ch</strong>ineInfo;[/cpp]</p>
</blockquote>
<p>So ein Mischmasch solltest du prinzipiell meiden. Kann in komplexeren Projekten nur schiefgehen.</p>
<p>Und mit dem &quot;Kram&quot; meinst du Ordner und Dateien? Dann iteriere über alle Objekte und gib jedes einzeln aus/zurück/was-auch-immer.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2249368</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2249368</guid><dc:creator><![CDATA[Beifahrer]]></dc:creator><pubDate>Fri, 07 Sep 2012 12:02:44 GMT</pubDate></item><item><title><![CDATA[Reply to Kommt nur murks raus on Fri, 07 Sep 2012 14:15:10 GMT]]></title><description><![CDATA[<p>Enno schrieb:</p>
<blockquote>
<pre><code class="language-cpp">SYSInfo::SYSInfo(){
  struct sysinfo *mysys = new struct sysinfo;
  struct utsname myInfo;
  if(sysinfo(mysys)!=-1){
    Totalram=mysys-&gt;totalram/1024;
  }
  if (uname(&amp;myInfo) != -1) {
    SysnameInfo=myInfo.sysname;
    ReleaseInfo=myInfo.release;
    NodenameInfo=myInfo.nodename;
    MachineInfo=myInfo.machine;
  }
}

void *SYSInfo::getUpdateNetworkstat(){ 
  std::ifstream UpdateNetworkstat(&quot;/proc/net/dev&quot;);
  return UpdateNetworkstat;
}
</code></pre>
</blockquote>
<p>Wie heisst eure Anwendung? Glücksrad für Linux?^^</p>
<p>Machs doch so in der Art: (Fehlerabfragen müsste man noch einbauen)</p>
<pre><code class="language-cpp">#include &lt;iostream&gt;
#include &lt;fstream&gt;
#include &lt;vector&gt;
using namespace std;

class EineKlasse
{

        private:
                  vector&lt;char&gt;Data;
        public:
                  void getUpdateNetworkstat ( string filename );
                  void PrintNetworkstat();
};

void EineKlasse :: getUpdateNetworkstat ( string filename )
{
ifstream file( filename.c_str() );

            file.seekg(0,ios::end);
long size = file.tellg();
            file.seekg(0,ios::beg);

            Data.resize( size + 1);
            file.read(&amp;Data[0],size );

            Data[size]='\x00';  // Nullterminator anhängen, sonst gibt cout lustige ASCII Zeichen mit aus
}

void EineKlasse :: PrintNetworkstat ()
{
        cout&lt;&lt;&amp;Data[0]&lt;&lt;endl;
}

int main()
{

EineKlasse abc;

abc.getUpdateNetworkstat( &quot;test.txt&quot; );
abc.PrintNetworkstat();

return 0;
}
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/2249375</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2249375</guid><dc:creator><![CDATA[Bassmaster]]></dc:creator><pubDate>Fri, 07 Sep 2012 14:15:10 GMT</pubDate></item><item><title><![CDATA[Reply to Kommt nur murks raus on Fri, 07 Sep 2012 13:14:41 GMT]]></title><description><![CDATA[<p>Korrigiere wenn ich mich irre, aber damit bist du im ungültigen Bereich:</p>
<blockquote>
<pre><code class="language-cpp">Data[size]='\x00';
</code></pre>
</blockquote>
<p>Daher</p>
<pre><code class="language-cpp">Data.resize(size+1)
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/2249391</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2249391</guid><dc:creator><![CDATA[Beifahrer]]></dc:creator><pubDate>Fri, 07 Sep 2012 13:14:41 GMT</pubDate></item><item><title><![CDATA[Reply to Kommt nur murks raus on Fri, 07 Sep 2012 14:14:28 GMT]]></title><description><![CDATA[<p>Oops ja stimmt, mein Fehler habs oben korrigiert.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2249409</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2249409</guid><dc:creator><![CDATA[Bassmaster]]></dc:creator><pubDate>Fri, 07 Sep 2012 14:14:28 GMT</pubDate></item><item><title><![CDATA[Reply to Kommt nur murks raus on Fri, 07 Sep 2012 18:29:48 GMT]]></title><description><![CDATA[<p>Enno schrieb:</p>
<blockquote>
<p><a class="plugin-mentions-user plugin-mentions-a" href="https://www.c-plusplus.net/forum/uid/4465">@Tachyon</a><br />
Ich wollte den kram den in dem Verzeichnis &quot;/proc/net/dev&quot; zurück geben ... geht das so nicht?</p>
</blockquote>
<p>/proc/net/dev ist unter Linux aber kein Verzeichnis. Bitte informiere dich doch einfach erstmal, bevor du wild irgendeinen Unsinn durch den Compiler jagst. Mit proc(5) (einfach &quot;man 5 proc&quot; auf der Konsole eingeben) könntest du anfangen.</p>
<p>Ein Buch über C++ und Unix/Linux wäre aber auch nicht verkehrt. &quot;The Linux Programming Interface&quot; von Michael Kerrisk ist hier ein recht umfassendes und dennoch aktuelles Buch von ordentlicher Qualität.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2249456</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2249456</guid><dc:creator><![CDATA[HepSepp]]></dc:creator><pubDate>Fri, 07 Sep 2012 18:29:48 GMT</pubDate></item><item><title><![CDATA[Reply to Kommt nur murks raus on Mon, 10 Sep 2012 07:35:48 GMT]]></title><description><![CDATA[<p>also wenn ich bei mir cat /proc/net/dev eingebe zeigt der mir das hier an:</p>
<pre><code>Inter-|   Receive                                                |  Transmit
 face |bytes    packets errs drop fifo frame compressed multicast|bytes    packets errs drop fifo colls carrier compressed
    lo:   78345     251    0    0    0     0          0         0    78345     251    0    0    0     0       0          0
 wlan0:       0       0    0    0    0     0          0         0        0       0    0    0    0     0       0          0
  eth0: 6131451    9365    0    0    0     0          0      2522   552388    4420    0    0    0     0       0          0
</code></pre>
<p>d.h. doch dann wohl das das ein verzeichnis ist was ich auslesen kann? oder verstehe ich da etwas kommplett falsch?</p>
<pre><code>/proc/net/dev
              The  dev  pseudo-file contains network device status information.  This gives the number of received and sent pack‐
              ets, the number of errors and collisions and other basic statistics.  These are used by the ifconfig(8) program  to
              report device status.
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/2249833</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2249833</guid><dc:creator><![CDATA[Enno]]></dc:creator><pubDate>Mon, 10 Sep 2012 07:35:48 GMT</pubDate></item><item><title><![CDATA[Reply to Kommt nur murks raus on Mon, 10 Sep 2012 08:20:20 GMT]]></title><description><![CDATA[<p>Wie viele Verzeichnisse kennst du, die man mit cat ausgeben kann und die auf der zugehörigen Manpage &quot;pseudo-file&quot; genannt werden?</p>
<p>Ich glaube, HepSepp hat vollkommen recht. Wie viel sollen wir dir eigentlich noch helfen, wenn du die Antworten wegen mangelndem Hintergrundwissen doch nicht verstehst? Zumal dir in schon mehreren Threads Quasi-Komplettlösungen gegeben wurden, die du nicht als solche erkannt hast (siehe vorherige Bemerkung über Verstehen der Antworten).</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2249842</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2249842</guid><dc:creator><![CDATA[SeppJ]]></dc:creator><pubDate>Mon, 10 Sep 2012 08:20:20 GMT</pubDate></item><item><title><![CDATA[Reply to Kommt nur murks raus on Mon, 10 Sep 2012 09:12:32 GMT]]></title><description><![CDATA[<p>Bassmaster schrieb:</p>
<blockquote>
<p>Enno schrieb:</p>
<blockquote>
<pre><code class="language-cpp">SYSInfo::SYSInfo(){
  struct sysinfo *mysys = new struct sysinfo;
  struct utsname myInfo;
  if(sysinfo(mysys)!=-1){
    Totalram=mysys-&gt;totalram/1024;
  }
  if (uname(&amp;myInfo) != -1) {
    SysnameInfo=myInfo.sysname;
    ReleaseInfo=myInfo.release;
    NodenameInfo=myInfo.nodename;
    MachineInfo=myInfo.machine;
  }
}

void *SYSInfo::getUpdateNetworkstat(){ 
  std::ifstream UpdateNetworkstat(&quot;/proc/net/dev&quot;);
  return UpdateNetworkstat;
}
</code></pre>
</blockquote>
<p>Wie heisst eure Anwendung? Glücksrad für Linux?^^</p>
<p>Machs doch so in der Art: (Fehlerabfragen müsste man noch einbauen)</p>
<pre><code class="language-cpp">#include &lt;iostream&gt;
#include &lt;fstream&gt;
#include &lt;vector&gt;
using namespace std;

class EineKlasse
{

        private:
                  vector&lt;char&gt;Data;
        public:
                  void getUpdateNetworkstat ( string filename );
                  void PrintNetworkstat();
};

void EineKlasse :: getUpdateNetworkstat ( string filename )
{
ifstream file( filename.c_str() );

            file.seekg(0,ios::end);
long size = file.tellg();
            file.seekg(0,ios::beg);

            Data.resize( size + 1);
            file.read(&amp;Data[0],size );

            Data[size]='\x00';  // Nullterminator anhängen, sonst gibt cout lustige ASCII Zeichen mit aus
}

void EineKlasse :: PrintNetworkstat ()
{
        cout&lt;&lt;&amp;Data[0]&lt;&lt;endl;
}

int main()
{

EineKlasse abc;

abc.getUpdateNetworkstat( &quot;test.txt&quot; );
abc.PrintNetworkstat();

return 0;
}
</code></pre>
</blockquote>
<p>wenn ich das nun einbaue bekomme ich diesen fehler:</p>
<pre><code>43:8: Fehler: »class std::vector&lt;char&gt;« hat kein Element namens »resized«
</code></pre>
<p><a class="plugin-mentions-user plugin-mentions-a" href="https://www.c-plusplus.net/forum/uid/3822">@sepp</a><br />
tut mir leid ich hab nicht alles in diesem thread vorhin gelesen ...<br />
dazu hab ich wirklich kein plan und hab deswegen ja auch in meinem post gefragt ob ich das falsch verstanden habe.<br />
wenigstens versuche ich das alles hier zu lernen udn bin über jede hilfe dankbar wenns dich jedoch nervt dann weiß ich nicht lies es nicht oder lösche das?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2249862</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2249862</guid><dc:creator><![CDATA[Enno]]></dc:creator><pubDate>Mon, 10 Sep 2012 09:12:32 GMT</pubDate></item><item><title><![CDATA[Reply to Kommt nur murks raus on Mon, 10 Sep 2012 09:16:28 GMT]]></title><description><![CDATA[<p>Wenn du lernen willst, versuch doch mal den Fehler mit dem resized selber zu lösen. Wie würdest du anfangen, wenn du einen solchen Fehler hast? Tipp: Compiler haben immer Recht, es gibt tatsächlich keine Methode &quot;resized&quot; in std::vector.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2249863</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2249863</guid><dc:creator><![CDATA[SeppJ]]></dc:creator><pubDate>Mon, 10 Sep 2012 09:16:28 GMT</pubDate></item><item><title><![CDATA[Reply to Kommt nur murks raus on Mon, 10 Sep 2012 09:18:20 GMT]]></title><description><![CDATA[<p>Enno schrieb:</p>
<blockquote>
<pre><code>43:8: Fehler: »class std::vector&lt;char&gt;« hat kein Element namens »resized«
</code></pre>
</blockquote>
<p>resize<strong>d</strong>? Gute Guete, du wirst das doch hoffentlich nicht abgetippt haben, oder? <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f62e.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--face_with_open_mouth"
      title=":open_mouth:"
      alt="😮"
    /></p>
]]></description><link>https://www.c-plusplus.net/forum/post/2249864</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2249864</guid><dc:creator><![CDATA[nman]]></dc:creator><pubDate>Mon, 10 Sep 2012 09:18:20 GMT</pubDate></item><item><title><![CDATA[Reply to Kommt nur murks raus on Mon, 10 Sep 2012 09:33:38 GMT]]></title><description><![CDATA[<p>SeppJ schrieb:</p>
<blockquote>
<p>Wenn du lernen willst, versuch doch mal den Fehler mit dem resized selber zu lösen. Wie würdest du anfangen, wenn du einen solchen Fehler hast? Tipp: Compiler haben immer Recht, es gibt tatsächlich keine Methode &quot;resized&quot; in std::vector.</p>
</blockquote>
<p>edit: fail</p>
<p>habs nun erst ganz raus gemacht und dann dort nachgelesen wies heißt</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2249866</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2249866</guid><dc:creator><![CDATA[Enno]]></dc:creator><pubDate>Mon, 10 Sep 2012 09:33:38 GMT</pubDate></item><item><title><![CDATA[Reply to Kommt nur murks raus on Mon, 10 Sep 2012 09:31:08 GMT]]></title><description><![CDATA[<p>Meinst du das eigentlich ernst? Das ist ein Nachbau von vector für C und hat mit std::vector herzlich wenig am Hut. Die richtige Referenz ist hier:<br />
<a href="http://www.cplusplus.com/reference/stl/vector/" rel="nofollow">http://www.cplusplus.com/reference/stl/vector/</a></p>
]]></description><link>https://www.c-plusplus.net/forum/post/2249870</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2249870</guid><dc:creator><![CDATA[Athar]]></dc:creator><pubDate>Mon, 10 Sep 2012 09:31:08 GMT</pubDate></item><item><title><![CDATA[Reply to Kommt nur murks raus on Mon, 10 Sep 2012 09:34:28 GMT]]></title><description><![CDATA[<p>nu bekomm ich halt immer diesen fehler:</p>
<pre><code>Speicherzugriffsfehler (Speicherabzug geschrieben)
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/2249873</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2249873</guid><dc:creator><![CDATA[Enno]]></dc:creator><pubDate>Mon, 10 Sep 2012 09:34:28 GMT</pubDate></item><item><title><![CDATA[Reply to Kommt nur murks raus on Mon, 10 Sep 2012 09:38:41 GMT]]></title><description><![CDATA[<p>Das liegt daran, dass du etwas falsch gemacht hast.<br />
Ernsthaft: benutze den Debugger (valgrind oder auch gdb) und finde heraus, in welcher Zeile das passiert.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2249875</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2249875</guid><dc:creator><![CDATA[Athar]]></dc:creator><pubDate>Mon, 10 Sep 2012 09:38:41 GMT</pubDate></item><item><title><![CDATA[Reply to Kommt nur murks raus on Mon, 10 Sep 2012 09:37:47 GMT]]></title><description><![CDATA[<p>ah danke</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2249877</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2249877</guid><dc:creator><![CDATA[Enno]]></dc:creator><pubDate>Mon, 10 Sep 2012 09:37:47 GMT</pubDate></item><item><title><![CDATA[Reply to Kommt nur murks raus on Mon, 10 Sep 2012 09:38:39 GMT]]></title><description><![CDATA[<p>Da hast du wohl murks gebaut.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2249881</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2249881</guid><dc:creator><![CDATA[Kellerautomat]]></dc:creator><pubDate>Mon, 10 Sep 2012 09:38:39 GMT</pubDate></item><item><title><![CDATA[Reply to Kommt nur murks raus on Mon, 10 Sep 2012 09:43:26 GMT]]></title><description><![CDATA[<p>abgeschrieben halt</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2249886</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2249886</guid><dc:creator><![CDATA[Enno]]></dc:creator><pubDate>Mon, 10 Sep 2012 09:43:26 GMT</pubDate></item><item><title><![CDATA[Reply to Kommt nur murks raus on Mon, 10 Sep 2012 10:11:35 GMT]]></title><description><![CDATA[<p>Habs nun so kannnst auch ohne fehler compelieren aber es erscheint nichts?</p>
<pre><code class="language-cpp">void SYSInfo::getDev(std::string filename){
  std::ifstream file(filename.c_str());
  file.seekg(0,std::ios::end);
  long size = file.tellg();
  file.seekg(0,std::ios::beg);
  Data.resize(size + 1);
  file.read(&amp;Data[0],size);
  Data[0]='\x00';
}

void SYSInfo::printDev(){
  std::cout &lt;&lt; &amp;Data[0] &lt;&lt; std::endl;
}
</code></pre>
<pre><code class="language-cpp">namespace exsystem {
class SYSInfo {
public
  void printDev();
  void getDev(std::string filename);
private:
  std::string Data;
  std::string Dev;
</code></pre>
<pre><code class="language-cpp">#include &quot;../sysinfo.h&quot;

int main(){

  exsystem::SYSInfo a; 
 a.getDev( &quot;/proc/meminfo&quot; ); 
  a.printDev();
  return 0;
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/2249890</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2249890</guid><dc:creator><![CDATA[Enno]]></dc:creator><pubDate>Mon, 10 Sep 2012 10:11:35 GMT</pubDate></item><item><title><![CDATA[Reply to Kommt nur murks raus on Mon, 10 Sep 2012 10:28:40 GMT]]></title><description><![CDATA[<p>Ich glaube nicht, dass Pseudodateien Seek-Operationen unterstützen.<br />
Und warum überhaupt so kompliziert?</p>
<pre><code class="language-cpp">#include &lt;iostream&gt;
#include &lt;fstream&gt;

int main()
{
    std::cout &lt;&lt; std::ifstream(&quot;/proc/meminfo&quot;).rdbuf();
}
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/2249895</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2249895</guid><dc:creator><![CDATA[MFK]]></dc:creator><pubDate>Mon, 10 Sep 2012 10:28:40 GMT</pubDate></item><item><title><![CDATA[Reply to Kommt nur murks raus on Mon, 10 Sep 2012 10:32:25 GMT]]></title><description><![CDATA[<pre><code class="language-cpp">#include &lt;iostream&gt;
#include &lt;fstream&gt;
using namespace std;

void getDev(std::string filename)
{
   std::ifstream file(filename.c_str());
   file.seekg(0,std::ios::end);
   long size = file.tellg();

   file.seekg(0,std::ios::beg);
   Data.resize(size + 1);
   file.read(&amp;Data[0],size);
}

int main(int argc, char* argv[])
{
getDev(&quot;test.txt&quot;);
cout&lt;&lt;&amp;Data[0]&lt;&lt;endl; //Geht auch so: cout&lt;&lt;Data&lt;&lt;endl;

return 0;
}
</code></pre>
<p>Hast du auch Text in deiner Datei drin stehen? ...<br />
Oder eventuell nur 1 Zeichen in der Textdatei welches durch den Angehangenen Nullterminator entfernt wird. Nimm mal mein Beispiel und sei dir sicher das in der Textdatei auch Text steht. ^^</p>
<p>Und std::vector nimmst du nicht weil du das mit dem resize nicht hinbekommst ... google: CompilerName vector resize<br />
Wäre eventuell in passender Suchbegriff.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2249898</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2249898</guid><dc:creator><![CDATA[Bassmaster]]></dc:creator><pubDate>Mon, 10 Sep 2012 10:32:25 GMT</pubDate></item><item><title><![CDATA[Reply to Kommt nur murks raus on Mon, 10 Sep 2012 10:33:15 GMT]]></title><description><![CDATA[<blockquote>
<p>Ich glaube nicht, dass Pseudodateien Seek-Operationen unterstützen.</p>
</blockquote>
<p>Selbst wenn sie es unterstützen würden (tun sie nicht), dann würde folgende Zeile immer noch alles ruinieren:</p>
<pre><code class="language-cpp">Data[0]='\x00';
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/2249899</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2249899</guid><dc:creator><![CDATA[Athar]]></dc:creator><pubDate>Mon, 10 Sep 2012 10:33:15 GMT</pubDate></item><item><title><![CDATA[Reply to Kommt nur murks raus on Mon, 10 Sep 2012 11:02:00 GMT]]></title><description><![CDATA[<p>MFK schrieb:</p>
<blockquote>
<p>Ich glaube nicht, dass Pseudodateien Seek-Operationen unterstützen.<br />
Und warum überhaupt so kompliziert?</p>
<pre><code class="language-cpp">#include &lt;iostream&gt;
#include &lt;fstream&gt;

int main()
{
    std::cout &lt;&lt; std::ifstream(&quot;/proc/meminfo&quot;).rdbuf();
}
</code></pre>
</blockquote>
<p>Ich solls mit der Klasse und mit get und set machen! Wäre ja schön wenns so leicht wäre <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f61e.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--disappointed_face"
      title=":("
      alt="😞"
    /></p>
<p>Bassmaster schrieb:</p>
<blockquote>
<pre><code class="language-cpp">#include &lt;iostream&gt; 
#include &lt;fstream&gt; 
using namespace std; 

void getDev(std::string filename) 
{ 
   std::ifstream file(filename.c_str()); 
   file.seekg(0,std::ios::end); 
   long size = file.tellg(); 

   file.seekg(0,std::ios::beg); 
   Data.resize(size + 1); 
   file.read(&amp;Data[0],size); 
} 

int main(int argc, char* argv[]) 
{ 
getDev(&quot;test.txt&quot;); 
cout&lt;&lt;&amp;Data[0]&lt;&lt;endl; //Geht auch so: cout&lt;&lt;Data&lt;&lt;endl; 

return 0; 
}
</code></pre>
</blockquote>
<p>sieht gut aus aber egal wie ich es mache ... also ob in der Klasse oder einfach alles in die Main ... der fehler bleibt:</p>
<pre><code>25:17: Fehler: »Data« wurde in diesem Gültigkeitsbereich nicht definiert

}
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/2249914</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2249914</guid><dc:creator><![CDATA[Enno]]></dc:creator><pubDate>Mon, 10 Sep 2012 11:02:00 GMT</pubDate></item></channel></rss>