<?xml version="1.0"?>
<rss version="2.0">
	<channel>
		<title>how to use fprintf in ALLEGRO_FILE?</title>
		<link>http://www.allegro.cc/forums/view/614438</link>
		<description>Allegro.cc Forum Thread</description>
		<webMaster>matthew@allegro.cc (Matthew Leverton)</webMaster>
		<lastBuildDate>Tue, 08 Jul 2014 19:18:01 +0000</lastBuildDate>
	</channel>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>i did not find some methods like al_fprintf().</p><p>and how to use fprintf?
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (vkensou)</author>
		<pubDate>Tue, 08 Jul 2014 07:43:49 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><div class="quote_container"><div class="title"><a href="http://www.allegro.cc/forums/thread/614438/1002866#target">vkensou</a> said:</div><div class="quote"><p> how to use fprintf</p></div></div><p>I assume you already know how to use printf.</p><p>You simply add the stream as the first parameter to fprintf().</p><p>If you said
</p><div class="source-code snippet"><div class="inner"><pre><a href="http://www.delorie.com/djgpp/doc/libc/libc_624.html" target="_blank">printf</a><span class="k2">(</span><span class="s">"Hello, world!\n"</span><span class="k2">)</span><span class="k2">;</span>
</pre></div></div><p>
it&#39;d be the same as
</p><div class="source-code snippet"><div class="inner"><pre><a href="http://www.delorie.com/djgpp/doc/libc/libc_345.html" target="_blank">fprintf</a><span class="k2">(</span>stdout,<span class="s">"Hello, world!\n"</span><span class="k2">)</span><span class="k2">;</span>
</pre></div></div><p>
but you can substitute some text file pointer for stdout, or stderr so redirection won&#39;t hide errors printed to console etc.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Arthur Kalliokoski)</author>
		<pubDate>Tue, 08 Jul 2014 08:03:40 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><div class="quote_container"><div class="title"><a href="http://www.allegro.cc/forums/thread/614438/1002867#target">Arthur Kalliokoski</a> said:</div><div class="quote"><p> You simply add the stream as the first parameter to fprintf().</p></div></div><p><span class="source-code"><a href="http://www.delorie.com/djgpp/doc/libc/libc_345.html" target="_blank">fprintf</a><span class="k2">(</span><span class="k2">)</span></span> expects a FILE, not an ALLEGRO_FILE.  It might work anyway, but I wouldn&#39;t rely on it.  </p><p>You can use <span class="source-code"><a href="http://www.delorie.com/djgpp/doc/libc/libc_732.html" target="_blank">snprintf</a><span class="k2">(</span><span class="k2">)</span></span> to create a formatted string, and then use <span class="source-code">al_puts<span class="k2">(</span><span class="k2">)</span></span> to write it to the file.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (LennyLen)</author>
		<pubDate>Tue, 08 Jul 2014 09:16:52 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Hm, that might be a bit of an oversight. Might want to add a al_fprintf and similar to the api
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Thomas Fjellstrom)</author>
		<pubDate>Tue, 08 Jul 2014 09:29:29 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Yes, that would be useful and nice to have, so I added it to the roadmap on the wiki. This is really not that hard to implement, so if anyone feels they want to do this, please do so and post your patch here or on the mailing list. <img src="http://www.allegro.cc/forums/smileys/smiley.gif" alt=":)" />
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (beoran)</author>
		<pubDate>Tue, 08 Jul 2014 10:46:54 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><div class="source-code snippet"><div class="inner"><pre>u <span class="k3">=</span> <a href="http://www.allegro.cc/manual/al_ustr_newf"><span class="a">al_ustr_newf</span></a><span class="k2">(</span>fmt, <span class="s">"%s"</span>, <span class="s">"blah"</span><span class="k2">)</span><span class="k2">;</span>
<a href="http://www.allegro.cc/manual/al_fputs"><span class="a">al_fputs</span></a><span class="k2">(</span>f, <a href="http://www.allegro.cc/manual/al_cstr"><span class="a">al_cstr</span></a><span class="k2">(</span>u<span class="k2">)</span><span class="k2">)</span><span class="k2">;</span>
<a href="http://www.allegro.cc/manual/al_ustr_free"><span class="a">al_ustr_free</span></a><span class="k2">(</span>u<span class="k2">)</span><span class="k2">;</span>
</pre></div></div><p>
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Elias)</author>
		<pubDate>Tue, 08 Jul 2014 19:18:01 +0000</pubDate>
	</item>
</rss>
