<?xml version="1.0"?>
<rss version="2.0">
	<channel>
		<title>Save_bitmap loop</title>
		<link>http://www.allegro.cc/forums/view/584944</link>
		<description>Allegro.cc Forum Thread</description>
		<webMaster>matthew@allegro.cc (Matthew Leverton)</webMaster>
		<lastBuildDate>Tue, 16 May 2006 10:06:17 +0000</lastBuildDate>
	</channel>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Ok. Dont ask why i need following, program code. Just suffice to say, i need it:</p><p>I need something like this -&gt;</p><p>while(x = 1000) {<br />draw_certain_bitmap_full_of_stuff();<br />save_bitmap(certain_bitmap,&quot;certain(int x).bmp&quot;);<br />}</p><p>Now it should do 1000 bmp files containing certain_bitmap and the file names should be:</p><p>certain1.bmp<br />certain2.bmp<br />certain3.bmp<br />certain4.bmp<br />etc<br />...</p><p>And for curious, no this is not for making screen capturing, but is ment for very special kind of animation program for our next film project. <img src="http://www.allegro.cc/forums/smileys/cheesy.gif" alt=":D" /></p><p>FAST ANSWERS PLEASE.. And correct too!
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Eradicor)</author>
		<pubDate>Tue, 16 May 2006 00:34:09 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Like this?</p><div class="source-code snippet"><div class="inner"><pre><span class="k1">int</span> x <span class="k3">=</span> <span class="n">1</span><span class="k2">;</span>
<span class="k1">while</span><span class="k2">(</span>x <span class="k3">&lt;</span><span class="k3">=</span> <span class="n">1000</span><span class="k2">)</span><span class="k2">{</span>
    <span class="k1">char</span> filename<span class="k2">[</span><span class="n">64</span><span class="k2">]</span><span class="k2">;</span>
    <a href="http://www.delorie.com/djgpp/doc/libc/libc_737.html" target="_blank">sprintf</a><span class="k2">(</span>filename, <span class="s">"certain%d.bmp"</span>, x<span class="k2">)</span><span class="k2">;</span>
    draw_certain_bitmap_full_of_stuff<span class="k2">(</span><span class="k2">)</span><span class="k2">;</span>
    <a href="http://www.allegro.cc/manual/save_bitmap" target="_blank"><span class="a">save_bitmap</span></a><span class="k2">(</span>certain_bitmap, filename<span class="k2">)</span><span class="k2">;</span>
    x<span class="k3">+</span><span class="k3">+</span><span class="k2">;</span>
<span class="k2">}</span>
</pre></div></div><p>

EDIT: Fixed code.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Mokkan)</author>
		<pubDate>Tue, 16 May 2006 00:50:11 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><div class="quote_container"><div class="title">Quote:</div><div class="quote"><p>
FAST ANSWERS PLEASE.. And correct too!
</p></div></div><p>
Sure!  As soon as I find the question...
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Onewing)</author>
		<pubDate>Tue, 16 May 2006 00:50:35 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Don&#39;t forget to increment x <img src="http://www.allegro.cc/forums/smileys/smiley.gif" alt=":)" /></p><p>[append]<br />IRC beats CGamesPlay to the edit.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (CGamesPlay)</author>
		<pubDate>Tue, 16 May 2006 00:52:24 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>First i considered not answering, because of your well, arrogant, tone.</p><p>But what the hey, i feel like &quot;giving&quot;.</p><p>And you obviously dont have any idea what you are doing.</p><div class="source-code snippet"><div class="inner"><pre><span class="k1">for</span><span class="k2">(</span><span class="k1">int</span> i<span class="k3">=</span><span class="n">1</span><span class="k2">;</span> i<span class="k3">&lt;</span><span class="k3">=</span><span class="n">1000</span><span class="k2">;</span> i<span class="k3">+</span><span class="k3">+</span><span class="k2">)</span>
<span class="k2">{</span>
  draw_certain_bitmap_full_of_stuff<span class="k2">(</span>certain_bitmap<span class="k2">)</span><span class="k2">;</span>
  <span class="k1">char</span> tmp<span class="k2">[</span><span class="n">256</span><span class="k2">]</span><span class="k2">;</span>
  <a href="http://www.delorie.com/djgpp/doc/libc/libc_737.html" target="_blank">sprintf</a><span class="k2">(</span>tmp,<span class="s">"certain%i.bmp"</span>,i<span class="k2">)</span><span class="k2">;</span>
  <a href="http://www.allegro.cc/manual/save_bitmap" target="_blank"><span class="a">save_bitmap</span></a><span class="k2">(</span>certain_bitmap,tmp<span class="k2">)</span><span class="k2">;</span>
<span class="k2">}</span>
</pre></div></div><p>
Untested, naturally, so i can&#39;t give any guarantees, but that should do it.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Jonatan Hedborg)</author>
		<pubDate>Tue, 16 May 2006 01:08:52 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>I would use %04d instead, to get 0001, 0002, 0003, etc. But it is just my taste.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (ReyBrujo)</author>
		<pubDate>Tue, 16 May 2006 01:21:03 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>i would be more concerned with people still using sprintf hasn&#39;t the last 3 years of &quot;secure&quot; programming hyperbole from just about everyone meant anything?</p><p>and whats with using file[64] and file[256] ?   how about using MAX_PATH</p><p>and what about clearing it before using it ?
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (A J)</author>
		<pubDate>Tue, 16 May 2006 02:34:59 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>I heard it mentioned that sprintf is &quot;bad&quot; in some way. Please elaborate =)<br />You don&#39;t need to clear it afaik, as it overwrites anything in the buffer and terminates with a \0. And i agree that %04i or even %05i would be better than just plain %i.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Jonatan Hedborg)</author>
		<pubDate>Tue, 16 May 2006 02:54:10 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><div class="quote_container"><div class="title">Quote:</div><div class="quote"><p>
I heard it mentioned that sprintf is &quot;bad&quot; in some way. Please elaborate =)
</p></div></div><p>
Buffer overruns. It doesn&#39;t check if it writes outside the size of the allocated memory buffer (because you don&#39;t tell it the size of the memory buffer).</p><div class="quote_container"><div class="title">Quote:</div><div class="quote"><p>
You don&#39;t need to clear it afaik
</p></div></div><p>
Correct.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Evert)</author>
		<pubDate>Tue, 16 May 2006 03:21:20 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Right. That would be bad. But it&#39;s not an issue here anyway.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Jonatan Hedborg)</author>
		<pubDate>Tue, 16 May 2006 03:53:39 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Bad code is always an issue.<br />This is computer science not poetry.<br />Computer science i tell you computer science..  mwahwhaaa!!
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (A J)</author>
		<pubDate>Tue, 16 May 2006 04:22:45 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><div class="quote_container"><div class="title">Jonatan Hedborg said:</div><div class="quote"><p>
 First i considered not answering, because of your well, arrogant, tone.
</p></div></div><p>

Heh thats new. </p><p>Well when you are on a hurry you dont have luxuary of being polite.</p><p>Anyway i solved this problem another way. Thanks however. That filename routine comes handy else where tho.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Eradicor)</author>
		<pubDate>Tue, 16 May 2006 10:06:17 +0000</pubDate>
	</item>
</rss>
