<?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[File öffnen]]></title><description><![CDATA[<p>Hallo zusammen,</p>
<p>ich habe eine Frage. Ich möchte einen File öffnen das ich weiter bearbeiten möchte ich zeige euch das mal am besten:</p>
<pre><code class="language-cpp">char* pOffsetFileName;
//This function read the offset file.
//Input: char* pOffsetFileName - file to read

void Interpolator::ReadOffsetFile(char* pOffsetFileName)
{
	//open the file
	FILE* pInFile = fopen(pOffsetFileName, &quot;r&quot;);
	if (pInFile == NULL)
	{
		m_ErrorType = BAD_OFFSET_FILE;
		return;
	}

	//Allocate memory for m_pTimeDistArray
	m_pTimeDistArray = new int [m_pSampledMotion-&gt;m_NumFrames];

	int frameNum, frameNumPrev = 0;
	//read the file
	for (int i = 0; i &lt; m_pSampledMotion-&gt;m_NumFrames; i++)
	{
		//read next line
		if (fscanf(pInFile, &quot;%d&quot;, &amp;frameNum) == -1)
		{
			m_ErrorType = BAD_OFFSET_FILE;
			return;
		}

		//Compute offset and store into array
		//offset = number of frames skipped between frame i and i-1
		m_pTimeDistArray[i] = frameNum - frameNumPrev - 1;	
		frameNumPrev = frameNum; 

	}
}
</code></pre>
<p>Das ist eine Programmier Aufgabe, ich möchte hierbei die Varible mit der Funktion fopen initialisieren. Krige das irgendwie nicht so hin, kann mir da jemand mal bitte unter die Arme greifen ?</p>
<p>Grüße</p>
<p>tyson</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/160740/file-öffnen</link><generator>RSS for Node</generator><lastBuildDate>Fri, 11 Sep 2026 08:35:25 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/160740.rss" rel="self" type="application/rss+xml"/><pubDate>Thu, 28 Sep 2006 21:31:34 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to File öffnen on Thu, 28 Sep 2006 21:31:34 GMT]]></title><description><![CDATA[<p>Hallo zusammen,</p>
<p>ich habe eine Frage. Ich möchte einen File öffnen das ich weiter bearbeiten möchte ich zeige euch das mal am besten:</p>
<pre><code class="language-cpp">char* pOffsetFileName;
//This function read the offset file.
//Input: char* pOffsetFileName - file to read

void Interpolator::ReadOffsetFile(char* pOffsetFileName)
{
	//open the file
	FILE* pInFile = fopen(pOffsetFileName, &quot;r&quot;);
	if (pInFile == NULL)
	{
		m_ErrorType = BAD_OFFSET_FILE;
		return;
	}

	//Allocate memory for m_pTimeDistArray
	m_pTimeDistArray = new int [m_pSampledMotion-&gt;m_NumFrames];

	int frameNum, frameNumPrev = 0;
	//read the file
	for (int i = 0; i &lt; m_pSampledMotion-&gt;m_NumFrames; i++)
	{
		//read next line
		if (fscanf(pInFile, &quot;%d&quot;, &amp;frameNum) == -1)
		{
			m_ErrorType = BAD_OFFSET_FILE;
			return;
		}

		//Compute offset and store into array
		//offset = number of frames skipped between frame i and i-1
		m_pTimeDistArray[i] = frameNum - frameNumPrev - 1;	
		frameNumPrev = frameNum; 

	}
}
</code></pre>
<p>Das ist eine Programmier Aufgabe, ich möchte hierbei die Varible mit der Funktion fopen initialisieren. Krige das irgendwie nicht so hin, kann mir da jemand mal bitte unter die Arme greifen ?</p>
<p>Grüße</p>
<p>tyson</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1146226</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1146226</guid><dc:creator><![CDATA[elturco]]></dc:creator><pubDate>Thu, 28 Sep 2006 21:31:34 GMT</pubDate></item><item><title><![CDATA[Reply to File öffnen on Fri, 29 Sep 2006 05:26:19 GMT]]></title><description><![CDATA[<p>Dieser Thread wurde von Moderator/in <a href="http://www.c-plusplus.net/forum/profile.php?mode=viewprofile&amp;u=9713" rel="nofollow">estartu</a> aus dem Forum <a href="http://www.c-plusplus.net/forum/viewforum.php?f=1" rel="nofollow">MFC (Visual C++)</a> in das Forum <a href="http://www.c-plusplus.net/forum/viewforum.php?f=15" rel="nofollow">C++</a> verschoben.</p>
<p>Im Zweifelsfall bitte auch folgende Hinweise beachten:<br />
<a href="http://www.c-plusplus.net/forum/viewtopic.php?t=39405" rel="nofollow">C/C++ Forum :: FAQ - Sonstiges :: Wohin mit meiner Frage?</a></p>
<p><em>Dieses Posting wurde automatisch erzeugt.</em></p>
]]></description><link>https://www.c-plusplus.net/forum/post/1146266</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1146266</guid><dc:creator><![CDATA[C++ Forumbot]]></dc:creator><pubDate>Fri, 29 Sep 2006 05:26:19 GMT</pubDate></item><item><title><![CDATA[Reply to File öffnen on Fri, 29 Sep 2006 05:31:32 GMT]]></title><description><![CDATA[<p>Mmmh. Der code sieht gut aus, wobei der richtige C++-Programmierer std::fstream nehmen würde. Was ist denn genau dein Problem?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1146269</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1146269</guid><dc:creator><![CDATA[Schildkroete]]></dc:creator><pubDate>Fri, 29 Sep 2006 05:31:32 GMT</pubDate></item><item><title><![CDATA[Reply to File öffnen on Fri, 29 Sep 2006 14:28:04 GMT]]></title><description><![CDATA[<p>Hallo nochmal zusammen,</p>
<p>ich sollte die Frage mal ein wenig anders stellen. Ich bin nicht so sehr vertraut mit C++.<br />
Es geht hierbei im &quot;Interplotion&quot; im Bereich Computer Animation, die Aufgabe besteht darin, dass ich eine &quot;Animation&quot; bekomme, wo z.B. ein Männeken am laufen ist und während die Animation läuft soll ich eine andere Animation hochladen, mit einem anderen Verhalten z.B. er geht diesmal rückwärts.<br />
Das Ziel ist es die übergänge der beiden Animationen so &quot;geschmeidig&quot; wie möglich zu machen, d.h. zu Interpolieren.</p>
<p>Ich versuche gerade dem Button &quot;Interpolate&quot; mitzuteilen, dass er eine Funktion aufrufen soll. Das sieht folgerdermaßen aus.</p>
<p>Der Konstruktor</p>
<pre><code class="language-cpp">Interpolator::Interpolator(Motion* pSampledMotion, char* pOffsetFileName)
{
    //Set default interpolation type
    m_InterpTypeToUse = LINEAR;

    //set default angle representation to use for interpolation
    m_AngleRepresToUse = EULER;

    //Set motion to be interpolated
    m_pSampledMotion = pSampledMotion;

    //Set ErrorType to NO_ERROR
    m_ErrorType = NO_ERROR_SET;

    //Init m_pTimeDistArray array
    m_pTimeDistArray = NULL;
    ReadOffsetFile(pOffsetFileName);
}
</code></pre>
<p>die Funktion ich aufrufen möchte: zuerst die erste und danach die zweite</p>
<pre><code class="language-cpp">void Interpolator::ReadOffsetFile(char* pOffsetFileName)
{
	//open the file
	FILE* pInFile = fopen(pOffsetFileName, &quot;r&quot;);
	if (pInFile == NULL)
	{
		m_ErrorType = BAD_OFFSET_FILE;
		return;
	}

	//Allocate memory for m_pTimeDistArray
	m_pTimeDistArray = new int [m_pSampledMotion-&gt;m_NumFrames];

	int frameNum, frameNumPrev = 0;
	//read the file
	for (int i = 0; i &lt; m_pSampledMotion-&gt;m_NumFrames; i++)
	{
		//read next line
		if (fscanf(pInFile, &quot;%d&quot;, &amp;frameNum) == -1)
		{
			m_ErrorType = BAD_OFFSET_FILE;
			return;
		}

		//Compute offset and store into array
		//offset = number of frames skipped between frame i and i-1
		m_pTimeDistArray[i] = frameNum - frameNumPrev - 1;	
		frameNumPrev = frameNum; 

	}
}

//Create interpolated motion
void Interpolator::Interpolate(Motion*&amp; pInterpMotion) 
{
	//Do nothing if error is set
	if (m_ErrorType != NO_ERROR_SET)
	{
		pInterpMotion = NULL;
		return;
	}

	//Compute number of frames int the new (interpolated) motion 
	int nNumFrames = 0;

	//Count all skipped frames
	for (int i = 0; i &lt; m_pSampledMotion-&gt;m_NumFrames; i++)
		nNumFrames += m_pTimeDistArray[i];

	//Add number of frames on the sampled file
	nNumFrames += m_pSampledMotion-&gt;m_NumFrames;

	//Allocate new motion - initially set to default motion
	pInterpMotion = new Motion(nNumFrames); 

	//Perform the interpolation
	if (m_InterpTypeToUse == LINEAR &amp;&amp; m_AngleRepresToUse == EULER)
		LinearInterpEulerAngles(pInterpMotion);
	else
	{
		//For now only linear interpolation of euler angles is supported
		m_ErrorType = NOT_SUPPORTED_INTERP_TYPE;
		delete pInterpMotion;
		pInterpMotion = NULL;
		return;
	}
}
</code></pre>
<p>Jetzt meine Frage ich mein die Frage ist wohl für den einen oder anderen ziemlich einfach, aber ich kenne mich halt nicht so sehr damit aus:<br />
Ich möchte meinem Button&quot; Interpolate sagen&quot; dass er eines Funktionen aufrufen soll, aber beim erzeugen des Objektes habe ich meine Probleme</p>
<pre><code class="language-cpp">static Motion *pSampledMotion = NULL;    
// Motion information as read from AMC file

//Interpolate loaded motion using linear interpolation
void interpolate_callback(Fl_Button *button, void *) 
{
    interpolate_button-&gt;value(); ??
    Interpolator neu = new Interpolator(pSampledMotion,????????);

}
</code></pre>
<p>Ich mein mein Konstruktor hat 2 Parameter, ich weiss hier nicht wie ich diesen 2 Parameter bestimmen kann. Ich kann sagen ok, fopen usw. aber in der Funktion ReadOffsetFile wird ja so ein File geöffnet ?</p>
<p>Habt Ihr meine Frage verstanden ???</p>
<p>Würd mich freuen wenn ihr mir helfen könntet...</p>
<p>Grüße</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1146620</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1146620</guid><dc:creator><![CDATA[elturco]]></dc:creator><pubDate>Fri, 29 Sep 2006 14:28:04 GMT</pubDate></item><item><title><![CDATA[Reply to File öffnen on Fri, 29 Sep 2006 14:59:20 GMT]]></title><description><![CDATA[<p>und Ausserdem wieso bekomme ich eine Fehlermeldung wenn ich einen Objekt erzeugen möchte mit dem Konstruktor :</p>
<pre><code class="language-cpp">Interpolator::Interpolator(Motion* pSampledMotion, char* pOffsetFileName)
{
	//Set default interpolation type
	m_InterpTypeToUse = LINEAR;

	//set default angle representation to use for interpolation
	m_AngleRepresToUse = EULER;

	//Set motion to be interpolated
	m_pSampledMotion = pSampledMotion;

	//Set ErrorType to NO_ERROR
	m_ErrorType = NO_ERROR_SET;

	//Init m_pTimeDistArray array
	m_pTimeDistArray = NULL;
	ReadOffsetFile(pOffsetFileName);
}
</code></pre>
<p>ich versuche einen Objekt zu erzeugen, indem ich:</p>
<pre><code class="language-cpp">static Motion *pSampledMotion = NULL;
char* OffsetFile = &quot;text.txt&quot;;

//Interpolate loaded motion using linear interpolation
void interpolate_callback(Fl_Button *button, void *) 
{
	interpolate_button-&gt;value();
	Interpolator neu = new Interpolator(pSampledMotion, OffsetFile);
}
</code></pre>
<p>Die Fehlermeldung die ich bekomme ist :</p>
<p>--------------------Configuration: key_frame1 - Win32 Debug--------------------<br />
Compiling...<br />
player.cxx<br />
C:\Dokumente und Einstellungen\Resul\Desktop\Partition\BILKENT\Computer Animation\Motion Capture\Acclaim\asf_amc_viewer 1-18-2005\viewer\player.cxx(202) : error C2440: 'initializing' : cannot convert from 'class Interpolator *' to 'class Interpolato<br />
r'<br />
No constructor could take the source type, or constructor overload resolution was ambiguous<br />
Error executing cl.exe.</p>
<p>key_frame1.exe - 1 error(s), 0 warning(s)</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1146635</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1146635</guid><dc:creator><![CDATA[elturco]]></dc:creator><pubDate>Fri, 29 Sep 2006 14:59:20 GMT</pubDate></item></channel></rss>