<?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[strncpy zu viele Argumente]]></title><description><![CDATA[<p>Guten Tag.</p>
<p>Ich schreib im Moment an einem Programm welches eine eingegebene Integerzahl in eine Pixelmatrix (8x5) anzeigt.</p>
<p>Also zum Beispiel:<br />
12 =<br />
...X. .XXX.<br />
..XX. X...X<br />
.X.X. ....X<br />
...X. ...X.<br />
...X. ..X..<br />
...X. .X...<br />
...X. X....<br />
...X. XXXXX</p>
<p>So. Als erstes habe ich Konstanten (2D Chararray) geschrieben welche diese Matrix für jede Zahl beinhaltet.</p>
<p>Jetzt habe ich eine Funktion geschreiben die für jede eingegebene Zahl die richtige Pixelmatrix zurückgibt und jetzt muss ja jede Pixelmatrix hintereinander angezeigt werden (wie oben). Somit habe ich ein weiteres Array (1D Chararray) erzeugt welches 8 (Index) Zeilen hat. Jetzt wollte ich nun die erste Zeile von der ersten Zahl ins 1D Array speichern und dahinter die erste Zeile von der zweiten Zahl usw.</p>
<p>Mein Funktion sieht nun so aus:</p>
<pre><code class="language-cpp">int fillPixelLineWithInt(int int_input, pixel_int_line_t *char_output)
{
	int int_output;
	char* string_input;
	const pixel_font_t *zeichen;

	pixel_font_t dump; //Dummy zum kopieren des char_outputs

	//Ausgabe ergibt sich aus dem Logarithmus von 10 (+1 weil erste Stelle = 0)
	int_output=log10((double)int_input)+1;

	//Eingabechar Array erstellen mit Stellenanzahl als Arrayanzahl
	string_input = new char[int_output];

	//Integer in String kopieren zum Logarithmus 10 (Dezimal)
	itoa(int_input,string_input,10);

	//Füllen des Arrays
	for(int i=0;i&lt;8;i++)
	{
		for(int j=0;j&lt;int_output;j++)
		{
			zeichen=getPixelsForChar(string_input[j]);
			if(zeichen!=NULL)
			{
				strncpy_s(dump,(char*)zeichen,int_output*5);
               //Fehler: 'strncpy_s': Funktion akzeptiert keine 3 Argumente

				for(int k=0;k&lt;5;k++)
				{
					*char_output[i]=dump[i][k];
				}
			}
		}
	}

	//Rückgabe der Stellen
	return int_output;
}
</code></pre>
<p>pixel_int_line_t ist ein char[8]<br />
pixel_font_t ist auch ein char[8][5]</p>
<p>Ich hab es auch schon ohne konstanten probiert, mit strcpy, mit strncpy und mit pixel_font_t[40] (1D Array für die Konstanten Matrizen).</p>
<p>Aber irgendetwas übersehe ich hier.</p>
<p>Keine Ahnung wie es zu diesem Fehler kommt. Bin halt noch absoluter Newbie.<br />
Hoffe ich hab das Problem gut erklärt und jemand von euch hat eine Idee woran es liegen könnte.</p>
<p>Vielen Dank schonmal im voraus.</p>
<p>mfg frock <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>
]]></description><link>https://www.c-plusplus.net/forum/topic/228495/strncpy-zu-viele-argumente</link><generator>RSS for Node</generator><lastBuildDate>Tue, 29 Sep 2026 14:54:49 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/228495.rss" rel="self" type="application/rss+xml"/><pubDate>Fri, 28 Nov 2008 23:55:45 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to strncpy zu viele Argumente on Fri, 28 Nov 2008 23:55:45 GMT]]></title><description><![CDATA[<p>Guten Tag.</p>
<p>Ich schreib im Moment an einem Programm welches eine eingegebene Integerzahl in eine Pixelmatrix (8x5) anzeigt.</p>
<p>Also zum Beispiel:<br />
12 =<br />
...X. .XXX.<br />
..XX. X...X<br />
.X.X. ....X<br />
...X. ...X.<br />
...X. ..X..<br />
...X. .X...<br />
...X. X....<br />
...X. XXXXX</p>
<p>So. Als erstes habe ich Konstanten (2D Chararray) geschrieben welche diese Matrix für jede Zahl beinhaltet.</p>
<p>Jetzt habe ich eine Funktion geschreiben die für jede eingegebene Zahl die richtige Pixelmatrix zurückgibt und jetzt muss ja jede Pixelmatrix hintereinander angezeigt werden (wie oben). Somit habe ich ein weiteres Array (1D Chararray) erzeugt welches 8 (Index) Zeilen hat. Jetzt wollte ich nun die erste Zeile von der ersten Zahl ins 1D Array speichern und dahinter die erste Zeile von der zweiten Zahl usw.</p>
<p>Mein Funktion sieht nun so aus:</p>
<pre><code class="language-cpp">int fillPixelLineWithInt(int int_input, pixel_int_line_t *char_output)
{
	int int_output;
	char* string_input;
	const pixel_font_t *zeichen;

	pixel_font_t dump; //Dummy zum kopieren des char_outputs

	//Ausgabe ergibt sich aus dem Logarithmus von 10 (+1 weil erste Stelle = 0)
	int_output=log10((double)int_input)+1;

	//Eingabechar Array erstellen mit Stellenanzahl als Arrayanzahl
	string_input = new char[int_output];

	//Integer in String kopieren zum Logarithmus 10 (Dezimal)
	itoa(int_input,string_input,10);

	//Füllen des Arrays
	for(int i=0;i&lt;8;i++)
	{
		for(int j=0;j&lt;int_output;j++)
		{
			zeichen=getPixelsForChar(string_input[j]);
			if(zeichen!=NULL)
			{
				strncpy_s(dump,(char*)zeichen,int_output*5);
               //Fehler: 'strncpy_s': Funktion akzeptiert keine 3 Argumente

				for(int k=0;k&lt;5;k++)
				{
					*char_output[i]=dump[i][k];
				}
			}
		}
	}

	//Rückgabe der Stellen
	return int_output;
}
</code></pre>
<p>pixel_int_line_t ist ein char[8]<br />
pixel_font_t ist auch ein char[8][5]</p>
<p>Ich hab es auch schon ohne konstanten probiert, mit strcpy, mit strncpy und mit pixel_font_t[40] (1D Array für die Konstanten Matrizen).</p>
<p>Aber irgendetwas übersehe ich hier.</p>
<p>Keine Ahnung wie es zu diesem Fehler kommt. Bin halt noch absoluter Newbie.<br />
Hoffe ich hab das Problem gut erklärt und jemand von euch hat eine Idee woran es liegen könnte.</p>
<p>Vielen Dank schonmal im voraus.</p>
<p>mfg frock <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>
]]></description><link>https://www.c-plusplus.net/forum/post/1622699</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1622699</guid><dc:creator><![CDATA[frock]]></dc:creator><pubDate>Fri, 28 Nov 2008 23:55:45 GMT</pubDate></item><item><title><![CDATA[Reply to strncpy zu viele Argumente on Sat, 29 Nov 2008 02:12:26 GMT]]></title><description><![CDATA[<p><a href="http://msdn.microsoft.com/en-us/library/5dae5d43(VS.80).aspx" rel="nofollow">http://msdn.microsoft.com/en-us/library/5dae5d43(VS.80).aspx</a></p>
<p>PS: In C++ nimmt man std::string statt char[] (std::string ist zwar auch nicht wirklich gut, aber besser als char[])</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1622720</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1622720</guid><dc:creator><![CDATA[12000 Mädchen]]></dc:creator><pubDate>Sat, 29 Nov 2008 02:12:26 GMT</pubDate></item><item><title><![CDATA[Reply to strncpy zu viele Argumente on Sat, 29 Nov 2008 02:15:38 GMT]]></title><description><![CDATA[<p>strncpy_s ist eine fragwürdige Microsoft-Extension und hat nix mit dem C++ Standard zu tun.<br />
Wieso schreibst du im Thread-Titel strncpy wenn du im Code strncpy_s verwendest?</p>
<p>Und wieso machst du nicht einfach die MSDN auf und guckst nach? Ist das so schwer? Anscheinend... <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/1622721</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1622721</guid><dc:creator><![CDATA[hustbaer]]></dc:creator><pubDate>Sat, 29 Nov 2008 02:15:38 GMT</pubDate></item></channel></rss>