<?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[einfacher avra Programmfehler]]></title><description><![CDATA[<p>Hallo,</p>
<p>ich wollte eigentlich nur (da ich noch ein blutiger Anfänger bin) in C++ ein Programm schreiben, bei dem man einen Pfad eingeben muss. Danach assembliert das Programm avra.exe (avra in cmd) die Assemblerdatei.</p>
<p>Mein Compiler meckert aber und gibt folgende Fehlermeldung aus:</p>
<p><em>TEST.cpp: In function 'INT32 main()':<br />
TEST.cpp:37:23: error: cannot convert 'STR32 {aka std::basic_string&lt;char&gt;}' to 'const char</em>' for argument '1' to 'int system(const char*)'*</p>
<p>Hier nun der C++ - Code (kompiliert mit g++.exe von MinGW32):</p>
<pre><code>#include &lt;iostream&gt;
#include &lt;math.h&gt;
#include &lt;stdlib.h&gt;
#include &lt;windows.h&gt;
using namespace std;

typedef signed short INT16;		// 16 Bit
typedef signed int INT32;		// 32 Bit
typedef signed long long int INT64;	// 64 Bit
typedef string STR32;		        // 32 Bit

struct data {
	STR32 eingabe0;
	STR32 ausgabe0;
} data;

void sleep (INT32 msec) {
	Sleep (msec);
};
void cclear () {
	system (&quot;cls&quot;);
};
void cpause () {
	system (&quot;pause &gt; NUL&quot;);
};
INT32 main () {
	cout &lt;&lt; &quot;Geben Sie den Pfad zu der .asm-Datei in Anfuehrungszeichen an:&quot;;
	cout &lt;&lt; endl;
	cin &gt;&gt; data.eingabe0;
	if ((data.eingabe0 == &quot;q&quot;)) {
		exit (0);
	};
	data.ausgabe0 = &quot;avra -o \&quot;main.hex\&quot; --includepath \&quot;C:\\avra\\includes\&quot; \&quot;&quot; + data.eingabe0 + &quot;\&quot;&quot;;
	system (data.ausgabe0);
	cout &lt;&lt; endl;
	cout &lt;&lt; endl;
	cpause ();
	return 0;
};
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/topic/317236/einfacher-avra-programmfehler</link><generator>RSS for Node</generator><lastBuildDate>Wed, 29 Jul 2026 11:26:22 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/317236.rss" rel="self" type="application/rss+xml"/><pubDate>Fri, 31 May 2013 21:07:22 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to einfacher avra Programmfehler on Fri, 31 May 2013 21:07:22 GMT]]></title><description><![CDATA[<p>Hallo,</p>
<p>ich wollte eigentlich nur (da ich noch ein blutiger Anfänger bin) in C++ ein Programm schreiben, bei dem man einen Pfad eingeben muss. Danach assembliert das Programm avra.exe (avra in cmd) die Assemblerdatei.</p>
<p>Mein Compiler meckert aber und gibt folgende Fehlermeldung aus:</p>
<p><em>TEST.cpp: In function 'INT32 main()':<br />
TEST.cpp:37:23: error: cannot convert 'STR32 {aka std::basic_string&lt;char&gt;}' to 'const char</em>' for argument '1' to 'int system(const char*)'*</p>
<p>Hier nun der C++ - Code (kompiliert mit g++.exe von MinGW32):</p>
<pre><code>#include &lt;iostream&gt;
#include &lt;math.h&gt;
#include &lt;stdlib.h&gt;
#include &lt;windows.h&gt;
using namespace std;

typedef signed short INT16;		// 16 Bit
typedef signed int INT32;		// 32 Bit
typedef signed long long int INT64;	// 64 Bit
typedef string STR32;		        // 32 Bit

struct data {
	STR32 eingabe0;
	STR32 ausgabe0;
} data;

void sleep (INT32 msec) {
	Sleep (msec);
};
void cclear () {
	system (&quot;cls&quot;);
};
void cpause () {
	system (&quot;pause &gt; NUL&quot;);
};
INT32 main () {
	cout &lt;&lt; &quot;Geben Sie den Pfad zu der .asm-Datei in Anfuehrungszeichen an:&quot;;
	cout &lt;&lt; endl;
	cin &gt;&gt; data.eingabe0;
	if ((data.eingabe0 == &quot;q&quot;)) {
		exit (0);
	};
	data.ausgabe0 = &quot;avra -o \&quot;main.hex\&quot; --includepath \&quot;C:\\avra\\includes\&quot; \&quot;&quot; + data.eingabe0 + &quot;\&quot;&quot;;
	system (data.ausgabe0);
	cout &lt;&lt; endl;
	cout &lt;&lt; endl;
	cpause ();
	return 0;
};
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/2327702</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2327702</guid><dc:creator><![CDATA[Seikuassi]]></dc:creator><pubDate>Fri, 31 May 2013 21:07:22 GMT</pubDate></item><item><title><![CDATA[Reply to einfacher avra Programmfehler on Fri, 31 May 2013 21:18:28 GMT]]></title><description><![CDATA[<p>der befehl</p>
<pre><code>system()
</code></pre>
<p>kann nur etwas mit c-strings anfangen.<br />
du kannst aber normale strings in c-strings konvertieren, so sollte das programm funktionieren.</p>
<pre><code>system(data.ausgabe0.c_str())
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/2327703</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2327703</guid><dc:creator><![CDATA[ameisengift]]></dc:creator><pubDate>Fri, 31 May 2013 21:18:28 GMT</pubDate></item><item><title><![CDATA[Reply to einfacher avra Programmfehler on Fri, 31 May 2013 21:24:08 GMT]]></title><description><![CDATA[<p>So wie es aussieht programmierst du unter Windows, also empfehle ich dir ShellExecute anstelle system zu verwenden.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2327707</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2327707</guid><dc:creator><![CDATA[U-Bahn]]></dc:creator><pubDate>Fri, 31 May 2013 21:24:08 GMT</pubDate></item><item><title><![CDATA[Reply to einfacher avra Programmfehler on Fri, 31 May 2013 21:37:55 GMT]]></title><description><![CDATA[<pre><code>system(data.ausgabe0.c_str())
</code></pre>
<p>funktioniert. Da ich aber noch ein Anfänger bin, muss ich fragen, was der Unterschied zwischen</p>
<pre><code>string
</code></pre>
<p>und</p>
<pre><code>c.str()
</code></pre>
<p>ist.</p>
<p>Danke nochmal!</p>
<p>Seikuassi</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2327709</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2327709</guid><dc:creator><![CDATA[Seikuassi]]></dc:creator><pubDate>Fri, 31 May 2013 21:37:55 GMT</pubDate></item><item><title><![CDATA[Reply to einfacher avra Programmfehler on Fri, 31 May 2013 21:42:04 GMT]]></title><description><![CDATA[<p>Ich weiß, ich könnte es nachlesen, aber wie würde der Programmaufruf mit ShellExecute aussehen?</p>
<p>Danke im Voraus!</p>
<p>Seikuassi</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2327711</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2327711</guid><dc:creator><![CDATA[Seikuassi]]></dc:creator><pubDate>Fri, 31 May 2013 21:42:04 GMT</pubDate></item><item><title><![CDATA[Reply to einfacher avra Programmfehler on Sat, 01 Jun 2013 10:28:21 GMT]]></title><description><![CDATA[<p>Strings werden in C und C++ gespeichert, indem man einfach einen Pointer auf den ersten Buchstaben speichert.<br />
Anhand dieses Pointers kann man solange den String durchsuchen, bis ein 0 Character auftaucht (keine '0' sondern wirklich 0) oder alternativ die Stringlänge in einer anderen Variable speichern.<br />
Viele Funktionen benötigen String-Parameter in dieser Form.</p>
<p>Mit pointern arbeiten kann aber oft ziemlich eklig sein, denn es reicht nicht nur den Pointer zu kopieren, sondern man muss auch den String, auf den er zeigt kopieren.</p>
<p>std::string ist eine Klasse, die diesen ganzen Kram selbsständig macht, und deswegen viel übersichtlicher, einfacher und weniger fehleranfälliger ist.</p>
<p>Mit .c_str() kann man aber auf den Pointer zugreifen, wenn man ihn doch mal benötigt.</p>
<pre><code>ShellExecute(NULL, NULL, datei, parameter, NULL, SW_SHOWDEFAULT);
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/2327754</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2327754</guid><dc:creator><![CDATA[Marthog]]></dc:creator><pubDate>Sat, 01 Jun 2013 10:28:21 GMT</pubDate></item></channel></rss>