<?xml version="1.0"?>
<rss version="2.0">
	<channel>
		<title>Reading a packfile</title>
		<link>http://www.allegro.cc/forums/view/589285</link>
		<description>Allegro.cc Forum Thread</description>
		<webMaster>matthew@allegro.cc (Matthew Leverton)</webMaster>
		<lastBuildDate>Wed, 27 Dec 2006 13:43:30 +0000</lastBuildDate>
	</channel>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>I <s>have</s> <b>had</b> a structure with defines an x and y coordinate, as well as a 20-character name.</p><p>When reading in from the packfile, I would simply use:
</p><div class="source-code"><div class="toolbar"></div><div class="inner"><table width="100%"><tbody><tr><td class="number">1</td><td><span class="k1">struct</span> itemType</td></tr><tr><td class="number">2</td><td><span class="k2">{</span></td></tr><tr><td class="number">3</td><td>  <span class="k1">int</span> x<span class="k2">;</span></td></tr><tr><td class="number">4</td><td>  <span class="k1">int</span> y<span class="k2">;</span></td></tr><tr><td class="number">5</td><td>  <span class="k1">char</span> name<span class="k2">[</span><span class="n">20</span><span class="k2">]</span><span class="k2">;</span></td></tr><tr><td class="number">6</td><td><span class="k2">}</span><span class="k2">;</span></td></tr><tr><td class="number">7</td><td>&#160;</td></tr><tr><td class="number">8</td><td>itemType loadData<span class="k2">(</span><a href="http://www.allegro.cc/manual/PACKFILE" target="_blank"><span class="a">PACKFILE</span></a> <span class="k3">*</span>f<span class="k2">)</span></td></tr><tr><td class="number">9</td><td><span class="k2">{</span></td></tr><tr><td class="number">10</td><td>  itemType newItem<span class="k2">;</span></td></tr><tr><td class="number">11</td><td>&#160;</td></tr><tr><td class="number">12</td><td>  <a href="http://www.allegro.cc/manual/pack_fread" target="_blank"><span class="a">pack_fread</span></a><span class="k2">(</span>newItem.name, <span class="k1">sizeof</span><span class="k2">(</span>newItem.name<span class="k2">)</span>, f<span class="k2">)</span><span class="k2">;</span></td></tr><tr><td class="number">13</td><td>  newItem.x <span class="k3">=</span> <a href="http://www.allegro.cc/manual/pack_igetw" target="_blank"><span class="a">pack_igetw</span></a><span class="k2">(</span>f<span class="k2">)</span><span class="k2">;</span></td></tr><tr><td class="number">14</td><td>  newItem.y <span class="k3">=</span> <a href="http://www.allegro.cc/manual/pack_igetw" target="_blank"><span class="a">pack_igetw</span></a><span class="k2">(</span>f<span class="k2">)</span><span class="k2">;</span></td></tr><tr><td class="number">15</td><td>&#160;</td></tr><tr><td class="number">16</td><td>  <span class="k1">return</span> newItem<span class="k2">;</span></td></tr><tr><td class="number">17</td><td><span class="k2">}</span></td></tr></tbody></table></div></div><p>

However, I want to change the name from a character to a std::string.  If I try to use the same routine, I&#39;ll have problems, since the size of the name will be different for each name.</p><p>Is there an alternate method I could use to read in an unknown-sized string variable with pack_fread?</p><p>One thought I had considered was something similar to <tt>std::cin.get(char c)</tt>.  It would only grab a single letter at a time, until it hit a &#39;\0&#39;.  Or, if I specify a string-type to pack_fread, will it be able to keep reading in data until it finds the &#39;\0&#39; itself?</p><p>Unfortunately, <a href="http://www.allegro.cc/manual/pack_fread">pack_fread</a> didn&#39;t seem to have any &quot;Similar topics&quot; on the page that I could check out...</p><p>Thanks if anyone knows!
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (TeamTerradactyl)</author>
		<pubDate>Wed, 27 Dec 2006 04:48:05 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>One option is to write/read the strings using the length-content string format, like:
</p><div class="source-code snippet"><div class="inner"><pre><span class="c">// write</span>
<a href="http://www.allegro.cc/manual/pack_iputw" target="_blank"><span class="a">pack_iputw</span></a><span class="k2">(</span>str.size<span class="k2">(</span><span class="k2">)</span>, f<span class="k2">)</span><span class="k2">;</span>
<a href="http://www.allegro.cc/manual/pack_fputs" target="_blank"><span class="a">pack_fputs</span></a><span class="k2">(</span>str.c_str<span class="k2">(</span><span class="k2">)</span>, f<span class="k2">)</span><span class="k2">;</span>

<span class="c">// read</span>
<a href="http://www.allegro.cc/manual/pack_igetw" target="_blank"><span class="a">pack_igetw</span></a><span class="k2">(</span>stringLength, f<span class="k2">)</span><span class="k2">;</span>
<span class="k1">char</span> <span class="k3">*</span>buffer <span class="k3">=</span> <span class="k1">new</span> <span class="k1">char</span><span class="k2">[</span>stringLength<span class="k3">+</span><span class="n">1</span><span class="k2">]</span><span class="k2">;</span>
<a href="http://www.allegro.cc/manual/pack_fread" target="_blank"><span class="a">pack_fread</span></a><span class="k2">(</span>buffer, stringLength, f<span class="k2">)</span><span class="k2">;</span>
buffer<span class="k2">[</span>stringLength<span class="k2">]</span> <span class="k3">=</span> <span class="s">'\0'</span><span class="k2">;</span>
string sth <span class="k3">=</span> buffer<span class="k2">;</span>
</pre></div></div><p>

Of course, you can also store them as zero-delimited, and use something like:
</p><div class="source-code snippet"><div class="inner"><pre><span class="c">// write</span>
<a href="http://www.allegro.cc/manual/pack_fputs" target="_blank"><span class="a">pack_fputs</span></a><span class="k2">(</span>str.c_str<span class="k2">(</span><span class="k2">)</span>, f<span class="k2">)</span><span class="k2">;</span>
<a href="http://www.allegro.cc/manual/pack_putc" target="_blank"><span class="a">pack_putc</span></a><span class="k2">(</span><span class="s">'\0'</span><span class="k2">)</span><span class="k2">;</span>

<span class="c">// read</span>
<span class="k1">char</span> c<span class="k2">;</span>
string buffer <span class="k3">=</span> <span class="s">""</span><span class="k2">;</span>
<span class="k1">while</span> <span class="k2">(</span>c <span class="k3">=</span> <a href="http://www.allegro.cc/manual/pack_getc" target="_blank"><span class="a">pack_getc</span></a><span class="k2">(</span>f<span class="k2">)</span><span class="k2">)</span>
    buffer <span class="k3">+</span><span class="k3">=</span> c<span class="k2">;</span>
</pre></div></div><p>

There is no easy built-in way, just wrap one of the above in two functions and use everywhere you need to save/load strings.</p><p>Also, to clear some stuff up, concerning the variable-sized string you mention. Actually, std::string is always the same size in memory, just like any other object in C++. The problem stems from the fact that a std::string internally stores a pointer to a character array, which makes no sense after writing it to a file and reading it back from it.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Jakub Wasilewski)</author>
		<pubDate>Wed, 27 Dec 2006 05:07:44 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Jakub, does the packfile save the number of bytes of data we are passing into it when saving, then?  That would tremendously simplify things for me!</p><p>If so, I may just have skipped that part <img src="http://www.allegro.cc/forums/smileys/grin.gif" alt=";D" /></p><p>So I can write to the packfile, telling it the size of my next string of text.  Then, when I read it again, I first pull out the size of the data, and then the actual data?</p><p>/me slaps forehead</p><p>Thanks!!
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (TeamTerradactyl)</author>
		<pubDate>Wed, 27 Dec 2006 05:14:45 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><div class="quote_container"><div class="title">Quote:</div><div class="quote"><p>
Jakub, does the packfile save the number of bytes of data we are passing into it when saving, then? That would tremendously simplify things for me!
</p></div></div><p>

Unfortunately, all packfiles provide is raw input/output, and the fputs/fgets pair. Almost everything works like the functions from stdio, so just look those up if you need <a href="http://www.cplusplus.com/ref/cstdio/fputs.html">reference</a> for pack_xxx. The differences are documented in the Allegro manual.</p><p>Actually, there is one pitfall with my code snippets above. Allegro&#39;s pack_fputs always saves stuff as UTF-8, which could cause various annoying errors with the code above. If you stick to ASCII you&#39;ll be okay, but if you need Unicode or Extended ASCII characters then you&#39;ll have to take care of this problem.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Jakub Wasilewski)</author>
		<pubDate>Wed, 27 Dec 2006 05:21:38 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>I <i>think</i> I&#39;ve got it now.  Let me know if this looks correct:
</p><div class="source-code"><div class="toolbar"></div><div class="inner"><table width="100%"><tbody><tr><td class="number">1</td><td><span class="c">/*! \brief Load the data in from a file</span></td></tr><tr><td class="number">2</td><td><span class="c"> *</span></td></tr><tr><td class="number">3</td><td><span class="c"> * The (open) packfile needs to be specified.</span></td></tr><tr><td class="number">4</td><td><span class="c"> */</span></td></tr><tr><td class="number">5</td><td><span class="k1">void</span> data::load<span class="k2">(</span><a href="http://www.allegro.cc/manual/PACKFILE" target="_blank"><span class="a">PACKFILE</span></a> <span class="k3">*</span>thePackfile<span class="k2">)</span></td></tr><tr><td class="number">6</td><td><span class="k2">{</span></td></tr><tr><td class="number">7</td><td>  itemType theItem<span class="k2">;</span></td></tr><tr><td class="number">8</td><td>  <span class="k1">const</span> uInt numItems<span class="k2">;</span></td></tr><tr><td class="number">9</td><td>  uInt stringLen<span class="k2">;</span></td></tr><tr><td class="number">10</td><td>&#160;</td></tr><tr><td class="number">11</td><td>  pItem.clear<span class="k2">(</span><span class="k2">)</span><span class="k2">;</span></td></tr><tr><td class="number">12</td><td>&#160;</td></tr><tr><td class="number">13</td><td>  numItems <span class="k3">=</span> <a href="http://www.allegro.cc/manual/pack_igetw" target="_blank"><span class="a">pack_igetw</span></a><span class="k2">(</span>thePackfile<span class="k2">)</span><span class="k2">;</span></td></tr><tr><td class="number">14</td><td>  <span class="k1">for</span> <span class="k2">(</span><span class="k1">int</span> i <span class="k3">=</span> <span class="n">0</span><span class="k2">;</span> i <span class="k3">&lt;</span> numItems<span class="k2">;</span> i<span class="k3">+</span><span class="k3">+</span><span class="k2">)</span></td></tr><tr><td class="number">15</td><td>  <span class="k2">{</span></td></tr><tr><td class="number">16</td><td>    stringLen <span class="k3">=</span> <a href="http://www.allegro.cc/manual/pack_igetw" target="_blank"><span class="a">pack_igetw</span></a><span class="k2">(</span>thePackfile<span class="k2">)</span><span class="k2">;</span></td></tr><tr><td class="number">17</td><td>&#160;</td></tr><tr><td class="number">18</td><td>    <a href="http://www.allegro.cc/manual/pack_fread" target="_blank"><span class="a">pack_fread</span></a><span class="k2">(</span>theItem.name, stringLen, thePackfile<span class="k2">)</span><span class="k2">;</span> <span class="c">// name is a string</span></td></tr><tr><td class="number">19</td><td>    theItem.x <span class="k3">=</span> <a href="http://www.allegro.cc/manual/pack_igetw" target="_blank"><span class="a">pack_igetw</span></a><span class="k2">(</span>thePackfile<span class="k2">)</span><span class="k2">;</span></td></tr><tr><td class="number">20</td><td>    theItem.y <span class="k3">=</span> <a href="http://www.allegro.cc/manual/pack_igetw" target="_blank"><span class="a">pack_igetw</span></a><span class="k2">(</span>thePackfile<span class="k2">)</span><span class="k2">;</span></td></tr><tr><td class="number">21</td><td>&#160;</td></tr><tr><td class="number">22</td><td>    pItem.push_back<span class="k2">(</span>theItem<span class="k2">)</span><span class="k2">;</span> <span class="c">// pItem is a vector</span></td></tr><tr><td class="number">23</td><td>  <span class="k2">}</span></td></tr><tr><td class="number">24</td><td><span class="k2">}</span></td></tr><tr><td class="number">25</td><td>&#160;</td></tr><tr><td class="number">26</td><td>&#160;</td></tr><tr><td class="number">27</td><td><span class="c">/*! \brief Save all the data out to a file</span></td></tr><tr><td class="number">28</td><td><span class="c"> *</span></td></tr><tr><td class="number">29</td><td><span class="c"> * The (open) packfile needs to be specified.</span></td></tr><tr><td class="number">30</td><td><span class="c"> *</span></td></tr><tr><td class="number">31</td><td><span class="c"> * \returns Number of items found in the packfile</span></td></tr><tr><td class="number">32</td><td><span class="c"> */</span></td></tr><tr><td class="number">33</td><td>uInt data::save<span class="k2">(</span><a href="http://www.allegro.cc/manual/PACKFILE" target="_blank"><span class="a">PACKFILE</span></a> <span class="k3">*</span>thePackfile<span class="k2">)</span></td></tr><tr><td class="number">34</td><td><span class="k2">{</span></td></tr><tr><td class="number">35</td><td>  <span class="k1">const</span> uInt numItems<span class="k2">;</span></td></tr><tr><td class="number">36</td><td>  uInt stringLen<span class="k2">;</span></td></tr><tr><td class="number">37</td><td>&#160;</td></tr><tr><td class="number">38</td><td>  numItems <span class="k3">=</span> pItem.size<span class="k2">(</span><span class="k2">)</span><span class="k2">;</span></td></tr><tr><td class="number">39</td><td>  <a href="http://www.allegro.cc/manual/pack_iputw" target="_blank"><span class="a">pack_iputw</span></a><span class="k2">(</span>numItems, thePackfile<span class="k2">)</span><span class="k2">;</span></td></tr><tr><td class="number">40</td><td>  <span class="k1">for</span> <span class="k2">(</span><span class="k1">int</span> i <span class="k3">=</span> <span class="n">0</span><span class="k2">;</span> i <span class="k3">&lt;</span> pItem.size<span class="k2">(</span><span class="k2">)</span><span class="k2">;</span> i<span class="k3">+</span><span class="k3">+</span><span class="k2">)</span></td></tr><tr><td class="number">41</td><td>  <span class="k2">{</span></td></tr><tr><td class="number">42</td><td>    stringLen <span class="k3">=</span> pItem<span class="k3">&lt;</span>i&gt;.name.size<span class="k2">(</span><span class="k2">)</span><span class="k2">;</span></td></tr><tr><td class="number">43</td><td>&#160;</td></tr><tr><td class="number">44</td><td>    <a href="http://www.allegro.cc/manual/pack_iputw" target="_blank"><span class="a">pack_iputw</span></a><span class="k2">(</span>stringLen, thePackfile<span class="k2">)</span><span class="k2">;</span></td></tr><tr><td class="number">45</td><td>    <a href="http://www.allegro.cc/manual/pack_fwrite" target="_blank"><span class="a">pack_fwrite</span></a><span class="k2">(</span>pItem<span class="k3">&lt;</span>i&gt;.name.c_str<span class="k2">(</span><span class="k2">)</span>, stringLen, thePackfile<span class="k2">)</span><span class="k2">;</span></td></tr><tr><td class="number">46</td><td>    <a href="http://www.allegro.cc/manual/pack_iputw" target="_blank"><span class="a">pack_iputw</span></a><span class="k2">(</span>pItem<span class="k3">&lt;</span>i&gt;.x, thePackfile<span class="k2">)</span><span class="k2">;</span></td></tr><tr><td class="number">47</td><td>    <a href="http://www.allegro.cc/manual/pack_iputw" target="_blank"><span class="a">pack_iputw</span></a><span class="k2">(</span>pItem<span class="k3">&lt;</span>i&gt;.y, thePackfile<span class="k2">)</span><span class="k2">;</span></td></tr><tr><td class="number">48</td><td>  <span class="k2">}</span></td></tr><tr><td class="number">49</td><td>&#160;</td></tr><tr><td class="number">50</td><td>  <span class="k1">return</span> pItem.size<span class="k2">(</span><span class="k2">)</span><span class="k2">;</span></td></tr><tr><td class="number">51</td><td><span class="k2">}</span></td></tr></tbody></table></div></div><p>

If so, thanks for the push in the right direction, Jakub!</p><p>EDIT: Changed the code a little (forgot to save the size to the packfile in the previous revision).
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (TeamTerradactyl)</author>
		<pubDate>Wed, 27 Dec 2006 05:30:59 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><div class="quote_container"><div class="title">Quote:</div><div class="quote"><p>
</p><div class="source-code snippet"><div class="inner"><pre><a href="http://www.allegro.cc/manual/pack_fread" target="_blank"><span class="a">pack_fread</span></a><span class="k2">(</span>theItem.name, stringLen, thePackfile<span class="k2">)</span><span class="k2">;</span>
</pre></div></div><p>
</p></div></div><p>

This part won&#39;t work. Those buffers I used up there were declared for a reason. You try to read <i>literal characters</i> as the <i>std::string object</i>, which is bound to screw things up badly. Std::strings are quite different from char arrays - you can&#39;t treat them as such, you have to use appropriate constructors or operators to set the string.</p><p>When writing, you can use c_str() to get a C-like character array. However, this can&#39;t be used when reading, because the c_str() array is not modifiable.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Jakub Wasilewski)</author>
		<pubDate>Wed, 27 Dec 2006 06:18:29 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>I understand allegro is written in C, and not for C++.  Does that mean that allegro will never be able to use std::strings instead of char arrays? <img src="http://www.allegro.cc/forums/smileys/undecided.gif" alt=":-/" />
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (TeamTerradactyl)</author>
		<pubDate>Wed, 27 Dec 2006 06:57:45 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>You can use C++ with allegro, there is nothing stopping you from doing that.  You however need to be careful when using strings with allegro and know the limitations of going from a char array to a string and vice versa.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Steve Terry)</author>
		<pubDate>Wed, 27 Dec 2006 07:12:11 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>What I meant, was that there&#39;s not much chance that pack_fread() will ever utilize the std::string, is there?  Unless they wanted to rewrite allegro in C++ (or can C call the std template?)...  It&#39;s too bad.  It&#39;s about as annoying as std::iostream not being able to use strings either on &quot;theStream.open(std::string myString)&quot; <img src="http://www.allegro.cc/forums/smileys/smiley.gif" alt=":)" />
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (TeamTerradactyl)</author>
		<pubDate>Wed, 27 Dec 2006 07:24:04 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>You can always write wrapper functions...<br />Write the code once, use it many times.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Audric)</author>
		<pubDate>Wed, 27 Dec 2006 07:40:10 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Okay, now my next question:</p><p>I don&#39;t see a way to save a double/float to a packfile (I&#39;m looking at <a href="http://www.allegro.cc/manual/api/file-and-compression-routines/">PACKFILE</a> to see what to do).  I see the following, but nothing which clearly explains what I need to use here:</p><div class="source-code snippet"><div class="inner"><pre><a href="http://www.allegro.cc/manual/pack_getc" target="_blank"><span class="a">pack_getc</span></a> <span class="c">// Returns the next character from a stream.</span>
<a href="http://www.allegro.cc/manual/pack_putc" target="_blank"><span class="a">pack_putc</span></a> <span class="c">// Puts a character in the stream.</span>
<a href="http://www.allegro.cc/manual/pack_igetw" target="_blank"><span class="a">pack_igetw</span></a> <span class="c">// Like pack_getc(), but using 16-bit Intel byte ordering words.</span>
<a href="http://www.allegro.cc/manual/pack_iputw" target="_blank"><span class="a">pack_iputw</span></a> <span class="c">// Like pack_putc(), but using 16-bit Intel byte ordering words.</span>
<a href="http://www.allegro.cc/manual/pack_igetl" target="_blank"><span class="a">pack_igetl</span></a> <span class="c">// Like pack_getc(), but using 32-bit Intel byte ordering words.</span>
<a href="http://www.allegro.cc/manual/pack_iputl" target="_blank"><span class="a">pack_iputl</span></a> <span class="c">// Like pack_putc(), but using 32-bit Intel byte ordering words.</span>
<a href="http://www.allegro.cc/manual/pack_mgetw" target="_blank"><span class="a">pack_mgetw</span></a> <span class="c">// Like pack_getc(), but using 16-bit Motorola byte ordering words.</span>
<a href="http://www.allegro.cc/manual/pack_mputw" target="_blank"><span class="a">pack_mputw</span></a> <span class="c">// Like pack_putc(), but using 16-bit Motorola byte ordering words.</span>
<a href="http://www.allegro.cc/manual/pack_mgetl" target="_blank"><span class="a">pack_mgetl</span></a> <span class="c">// Like pack_getc(), but using 32-bit Motorola byte ordering words.</span>
<a href="http://www.allegro.cc/manual/pack_mputl" target="_blank"><span class="a">pack_mputl</span></a> <span class="c">// Like pack_putc(), but using 32-bit Motorola byte ordering words.</span>
</pre></div></div><p>

Would I want to use the 32-bit ones, since double/float may need that precision?
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (TeamTerradactyl)</author>
		<pubDate>Wed, 27 Dec 2006 12:49:33 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>I use my own method that just came natural (and somewhat from working on sockets).  I&#39;m not claiming it to be the best, it&#39;s just easy for me.  </p><p>For each item stored in my packfile, I write two chars (that&#39;s two bytes) to the beginning.  Bytes can store from 0-255.  These two bytes represent the size of the following data in bytes.  It kind of looks like this:</p><div class="source-code snippet"><div class="inner"><pre>ctransfer <span class="k3">=</span> <span class="k1">new</span> <span class="k1">char</span><span class="k2">[</span><a href="http://www.delorie.com/djgpp/doc/libc/libc_764.html" target="_blank">strlen</a><span class="k2">(</span>ctext<span class="k2">)</span> <span class="k3">+</span> <span class="n">2</span><span class="k2">]</span><span class="k2">;</span>
ctransfer<span class="k2">[</span><span class="n">0</span><span class="k2">]</span> <span class="k3">=</span> <a href="http://www.delorie.com/djgpp/doc/libc/libc_764.html" target="_blank">strlen</a><span class="k2">(</span>ctext<span class="k2">)</span> <span class="k3">/</span> <span class="n">255</span><span class="k2">;</span>
ctransfer<span class="k2">[</span><span class="n">1</span><span class="k2">]</span> <span class="k3">=</span> <a href="http://www.delorie.com/djgpp/doc/libc/libc_764.html" target="_blank">strlen</a><span class="k2">(</span>ctext<span class="k2">)</span> % <span class="n">255</span><span class="k2">;</span>
<a href="http://www.delorie.com/djgpp/doc/libc/libc_756.html" target="_blank">strcpy</a><span class="k2">(</span>ctransfer<span class="k3">+</span><span class="n">2</span>,ctext<span class="k2">)</span><span class="k2">;</span>
</pre></div></div><p>

Then you&#39;d pack_fwrite as normal using the ctransfer.  This way, you are storing the size specifically within the file.  I wrote a program to convert text files into this format, so I just use notepad to fill in the data and then use the converter to have it stored in a packfile.  </p><p>It&#39;s just what I do.  <img src="http://www.allegro.cc/forums/smileys/undecided.gif" alt=":-/" />
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Onewing)</author>
		<pubDate>Wed, 27 Dec 2006 13:43:30 +0000</pubDate>
	</item>
</rss>
