<?xml version="1.0"?>
<rss version="2.0">
	<channel>
		<title>How to store rgb information of a pixel on a text file? </title>
		<link>http://www.allegro.cc/forums/view/616987</link>
		<description>Allegro.cc Forum Thread</description>
		<webMaster>matthew@allegro.cc (Matthew Leverton)</webMaster>
		<lastBuildDate>Mon, 21 Aug 2017 05:59:40 +0000</lastBuildDate>
	</channel>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>I want to make an application in which any asset/image&#39;s rgb information is copied on a text file and then he can use that text file on my other application which reads rgb data of all pixels and construct a new copy of that particular asset. It reduces chances of asset alteration or simply makes it hard for others to change actual asset (according to me atleast).
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (divyesh ladva)</author>
		<pubDate>Sat, 29 Jul 2017 09:25:35 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>What version of Allegro are you using, and is this for C or C++?</p><p>But for A4, and C, something like this:</p><div class="source-code snippet"><div class="inner"><pre><span class="k1">int</span> c <span class="k3">=</span> <a href="http://www.allegro.cc/manual/getpixel"><span class="a">getpixel</span></a><span class="k2">(</span>x, y<span class="k2">)</span><span class="k2">;</span>
<a href="http://www.delorie.com/djgpp/doc/libc/libc_345.html" target="_blank">fprintf</a><span class="k2">(</span>file, <span class="s">"%d, %d, %d"</span>, <a href="http://www.allegro.cc/manual/getr"><span class="a">getr</span></a><span class="k2">(</span>c<span class="k2">)</span>, <a href="http://www.allegro.cc/manual/getg"><span class="a">getg</span></a><span class="k2">(</span>c<span class="k2">)</span>, <a href="http://www.allegro.cc/manual/getb"><span class="a">getb</span></a><span class="k2">(</span>c<span class="k2">)</span><span class="k2">)</span><span class="k2">;</span>
</pre></div></div><p>
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (LennyLen)</author>
		<pubDate>Sat, 29 Jul 2017 10:21:03 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>To be fair though, it&#39;s not that hard to write a program to construct a bitmap from R,G,B,R,G,B, etc.</p><p>It&#39;s harder if you perform a basic encryption and decryption of your assets because then people have to examine the binary of your program to figure out the key and how to decrypt the assets. Plus encryption works on any asset type - not just rgb images.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (jmasterx)</author>
		<pubDate>Sat, 29 Jul 2017 17:21:34 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>You could calculate a sha1 checksum of your resources and use that for verifying them.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (beoran)</author>
		<pubDate>Sun, 30 Jul 2017 03:22:41 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>If you&#39;re so concerned about people not being able to use modified assets with that second application (I&#39;m assuming the first app is a private one only you have access to and the second one is the public application that everyone else uses) your best bet is implementing a digital signature system:</p><p>Your application generates a digital signature for your assets, using a private key.<br />Your other application checks that the signature is correct when it loads the assets. People won&#39;t be able to modify your assets without knowing the private key, as they won&#39;t be able to generate a valid digital signature.</p><p>This is very easy to do by using any cryptography lib.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Oscar Giner)</author>
		<pubDate>Sun, 30 Jul 2017 09:32:17 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>1) LennyLen, I&#39;m using Allegro 5.2.0.</p><p>2) jmasterx, i know about that, but I&#39;m making this application for learning purpose only and yes i was gonna store rgb info in binary form too. </p><p>3) beoran, i don&#39;t know much about sha1, i know it is some form of hashing (i guess,).Can you pls elaborate it? </p><p>4) Oscar Giner, as i said earlier I&#39;m making it for information purpose only. But i would like to know how can i give my assets a digital signature. Is it done using allegro? </p><p>Thanks in advance.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (divyesh ladva)</author>
		<pubDate>Sun, 30 Jul 2017 11:56:38 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>You can use the sha2 functions from AllegroFlare if you&#39;re interested:</p><ul><li><p><a href="https://github.com/MarkOates/allegro_flare/blob/master/include/allegro_flare/sha2.h">sha2.h</a>
</p></li><li><p><a href="https://github.com/MarkOates/allegro_flare/blob/master/src/encryption/sha2.cpp">sha2.cpp</a>
</p></li><li><p>Test file: <a href="https://github.com/MarkOates/allegro_flare/blob/master/tests/sha2_test.cpp">sha2_test.cpp</a>
</p></li></ul></div>]]>
		</description>
		<author>no-reply@allegro.cc (Mark Oates)</author>
		<pubDate>Sun, 30 Jul 2017 12:40:17 +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/616987/1031842#target">divyesh ladva</a> said:</div><div class="quote"><p>
4) Oscar Giner, as i said earlier I&#39;m making it for information purpose only. But i would like to know how can i give my assets a digital signature. Is it done using allegro?
</p></div></div><p>
1. Generate a pair of public and private keys for a <a href="https://en.wikipedia.org/wiki/Public-key_cryptography">public-key cryptography algorithm</a> (like RSA). Your first app will use the private key to generate the signature and your other app will use the public key to verify the signature.<br />1. Generate a hash of the data (this is for performance reasons not for security, so just use the fastest hashing algorithm you can get).<br />2. Encrypt the hash with the private key. This is the signature.<br />3. When the other program wants to read the data you generate again the hash (using the exact same algorithm, both programs must generate the same hash for the same data) and decrypt the signature with the public key (remember, the signature is just the hash encrypted). The computed hash and the decrypted signature must be identical, otherwise the data has been modified.</p><p>Since no one knows the private key but you, if anyone tries to modify the data they won&#39;t be able to generate the signature (encrypted hash). Verifying the signature only requires the public key, so anyone can do that.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Oscar Giner)</author>
		<pubDate>Sun, 30 Jul 2017 19:31:32 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Oscar Giner, i understand what you say but how to actually implement it in a code? Can you provide a pseudo code or something like that?</p><p>Also i want to learn how to store multiple value in a single key and read em back or just store values in a section without any keys and read em back. For example, </p><div class="source-code"><div class="toolbar"><span class="button numbers"><b>#</b></span><span class="button select">Select</span><span class="button expand">Expand</span></div><div class="inner"><span class="number">  1</span><span class="k2">[</span>red_pixels_of_tiles<span class="k2">]</span>
<span class="number">  2</span>
<span class="number">  3</span><span class="n">1</span>,<span class="n">2</span>,<span class="n">3</span>,<span class="n">4</span>,<span class="n">5</span>,
<span class="number">  4</span><span class="n">6</span>,<span class="n">7</span>,<span class="n">8</span>,<span class="n">9</span>,<span class="n">0</span><span class="k2">;</span>
<span class="number">  5</span>
<span class="number">  6</span><span class="k2">[</span><span class="k3">/</span>red_pixels_of_tiles<span class="k2">]</span>
<span class="number">  7</span>
<span class="number">  8</span>And so on
</div></div><p>

Or like this, </p><div class="source-code"><div class="toolbar"><span class="button numbers"><b>#</b></span><span class="button select">Select</span><span class="button expand">Expand</span></div><div class="inner"><span class="number">  1</span>
<span class="number">  2</span><span class="k2">[</span>pixels<span class="k2">]</span>
<span class="number">  3</span>
<span class="number">  4</span>r<span class="k3">=</span><span class="n">1</span>,<span class="n">2</span>,<span class="n">3</span>,<span class="n">4</span><span class="k2">;</span>
<span class="number">  5</span>g<span class="k3">=</span><span class="n">5</span>,<span class="n">6</span>,<span class="n">7</span>,<span class="n">8</span><span class="k2">;</span>
<span class="number">  6</span>b<span class="k3">=</span><span class="n">9</span>,<span class="n">0</span>,<span class="n">1</span>,<span class="n">2</span><span class="k2">;</span>
<span class="number">  7</span>
<span class="number">  8</span><span class="k2">[</span><span class="k3">/</span>pixels<span class="k2">]</span>
</div></div><p>

I want to know how to write this type of config file and also how to read from this files and get any desired value. </p><p>Thanks in advance.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (divyesh ladva)</author>
		<pubDate>Wed, 02 Aug 2017 12:40:13 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>If you&#39;re only interested in validating that the content hasn&#39;t been tampered with, a simple hashing function is the easiest approach.  A public/private key isn&#39;t necessary in this case because you aren&#39;t needing to prove the identity of the owner.</p><h4>Generating a Hash</h4><p>

The easiest way to generate a hash of an image file is to use the <a href="https://github.com/MarkOates/allegro_flare/blob/master/include/allegro_flare/sha2.h#L20">get_sha256_hash_of_file() function</a> from AllegroFlare.  Simply pass the filename of the image to obtain the string.</p><div class="source-code snippet"><div class="inner"><pre>std::string image_hash <span class="k3">=</span> get_sha256_hash_of_file<span class="k2">(</span><span class="s">"bin/data/doggie.jpg"</span><span class="k2">)</span><span class="k2">;</span>
std::cout <span class="k3">&lt;</span><span class="k3">&lt;</span> image_hash <span class="k3">&lt;</span><span class="k3">&lt;</span> std::endl<span class="k2">;</span>  <span class="c">// will print 479d98072585c81c26019899c4b7161f6a844ed5ae9d707b656b7767cc5fb9aa</span>
</pre></div></div><p>

You can then save the output of this string in your application as a constant. </p><div class="source-code snippet"><div class="inner"><pre><span class="p">#define DOGGIE_IMAGE_HASH "479d98072585c81c26019899c4b7161f6a844ed5ae9d707b656b7767cc5fb9aa"</span>
</pre></div></div><p>

When you want to load the image in your application, you can check that the generated hash is identical to the expected hash:</p><div class="source-code snippet"><div class="inner"><pre><span class="k1">void</span> validate_doggie_image<span class="k2">(</span>std::string filename<span class="k3">=</span><span class="s">"bin/data/doggie.jpg"</span><span class="k2">)</span>
<span class="k2">{</span>
   std::string image_hash <span class="k3">=</span> get_sha256_hash_of_file<span class="k2">(</span>filename<span class="k2">)</span><span class="k2">;</span>
   <span class="k1">if</span> <span class="k2">(</span>image_hash <span class="k3">!</span><span class="k3">=</span> DOGGIE_IMAGE_HASH<span class="k2">)</span> <a href="http://www.delorie.com/djgpp/doc/libc/libc_636.html" target="_blank">raise</a> std::runtime_error<span class="k2">(</span><span class="s">"Doggie image invalid"</span><span class="k2">)</span><span class="k2">;</span>
<span class="k2">}</span>
</pre></div></div><p>
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Mark Oates)</author>
		<pubDate>Fri, 04 Aug 2017 06:37:26 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p><b>Mark Oates</b>, your answer for hash function came in handy to me. Thanks for that. But my original question still remains unanswered, how do i store rgb values of a single pixel of an image to a text file or config file(pls)? To quote again I&#39;m using <b> allegro 5.2.2 with code blocks compiler on windows 7</b>. And secondly i want to know how to store them in a specific manner in a config file in the way i told in my last reply.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (divyesh ladva)</author>
		<pubDate>Wed, 09 Aug 2017 17:07:40 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>A hint:  </p><p><a href="https://www.allegro.cc/manual/5/al_unmap_rgb">https://www.allegro.cc/manual/5/al_unmap_rgb</a>
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Arthur Kalliokoski)</author>
		<pubDate>Wed, 09 Aug 2017 18:16:48 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Are you asking about basic file input/output or are you asking about accessing the pixel data? LennyLen already demonstrated writing the file in the second post (first you need to <span class="source-code"><a href="http://www.delorie.com/djgpp/doc/libc/libc_337.html" target="_blank">fopen</a></span> the filename). One option to read it back in is using <span class="source-code"><a href="http://www.delorie.com/djgpp/doc/libc/libc_353.html" target="_blank">fscanf</a></span> to read it as a formatted string in the reverse of <span class="source-code"><a href="http://www.delorie.com/djgpp/doc/libc/libc_345.html" target="_blank">fprintf</a></span>. Those are C functions.</p><p>If you want a C++ solution then you&#39;d use a <span class="source-code">std::ofstream</span> and <span class="source-code">std::ifstream</span> to write and read the file similarly to how you write data to the standard output (`std::cout`) (console) stream.</p><p>You can learn loads of information about writing and reading files in C or C++ with Google. We&#39;d be happy to help you understand it if you have trouble.</p><p><b>Update:</b> Fixed C++ class names. <img src="http://www.allegro.cc/forums/smileys/lipsrsealed.gif" alt=":-X" />
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (bamccaig)</author>
		<pubDate>Thu, 10 Aug 2017 08:39:48 +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/616987/1032087#target">divyesh ladva</a> said:</div><div class="quote"><p> how do i store rgb values of a single pixel of an image to a text file or config file(pls)?</p></div></div><p>Well, there&#39;s two parts to that.  First, you need to obtain the pixel color data from the image, and next, write it to the file.</p><h3>Get the pixel color of an image.</h3><p>

To obtain the color from an image, you&#39;ll use <span class="source-code"><a href="http://www.allegro.cc/manual/al_get_pixel"><span class="a">al_get_pixel</span></a></span> to grab individual color components at a coordinate.</p><div class="source-code"><div class="toolbar"><span class="button numbers"><b>#</b></span><span class="button select">Select</span><span class="button expand">Expand</span></div><div class="inner"><span class="number">  1</span><span class="p">#include &lt;string&gt;</span>
<span class="number">  2</span><span class="p">#include &lt;allegro5/allegro.h&gt;</span>
<span class="number">  3</span>
<span class="number">  4</span><a href="http://www.allegro.cc/manual/ALLEGRO_COLOR"><span class="a">ALLEGRO_COLOR</span></a> get_image_color_at<span class="k2">(</span>std::string image_filename, <span class="k1">int</span> x, <span class="k1">int</span> y<span class="k2">)</span>
<span class="number">  5</span><span class="k2">{</span>
<span class="number">  6</span>   <a href="http://www.allegro.cc/manual/ALLEGRO_BITMAP"><span class="a">ALLEGRO_BITMAP</span></a> <span class="k3">*</span>bitmap <span class="k3">=</span> <a href="http://www.allegro.cc/manual/al_load_bitmap"><span class="a">al_load_bitmap</span></a><span class="k2">(</span>image_filename.c_str<span class="k2">(</span><span class="k2">)</span><span class="k2">)</span><span class="k2">;</span>
<span class="number">  7</span>
<span class="number">  8</span>   <span class="k1">if</span> <span class="k2">(</span><span class="k3">!</span>bitmap<span class="k2">)</span>
<span class="number">  9</span>      <span class="k1">throw</span> std::runtime_error<span class="k2">(</span><span class="s">"Cannot load pixel data: The image does not exist."</span><span class="k2">)</span><span class="k2">;</span>
<span class="number"> 10</span>
<span class="number"> 11</span>   <span class="k1">if</span> <span class="k2">(</span>x <span class="k3">&lt;</span> <span class="n">0</span> <span class="k3">|</span><span class="k3">|</span> x <span class="k3">&gt;</span><span class="k3">=</span> <a href="http://www.allegro.cc/manual/al_get_bitmap_width"><span class="a">al_get_bitmap_width</span></a><span class="k2">(</span>bitmap<span class="k2">)</span> <span class="k3">|</span><span class="k3">|</span> y <span class="k3">&lt;</span> <span class="n">0</span> <span class="k3">|</span><span class="k3">|</span> y <span class="k3">&gt;</span><span class="k3">=</span> <a href="http://www.allegro.cc/manual/al_get_bitmap_height"><span class="a">al_get_bitmap_height</span></a><span class="k2">(</span>bitmap<span class="k2">)</span><span class="k2">)</span>
<span class="number"> 12</span>      <span class="k1">throw</span> std::runtime_error<span class="k2">(</span><span class="s">"Cannot load pixel data: Coordinates of bounds"</span><span class="k2">)</span><span class="k2">;</span>
<span class="number"> 13</span>
<span class="number"> 14</span>   <a href="http://www.allegro.cc/manual/ALLEGRO_COLOR"><span class="a">ALLEGRO_COLOR</span></a> obtained_color <span class="k3">=</span> <a href="http://www.allegro.cc/manual/al_get_pixel"><span class="a">al_get_pixel</span></a><span class="k2">(</span>bitmap, x, y<span class="k2">)</span><span class="k2">;</span>
<span class="number"> 15</span>
<span class="number"> 16</span>   <a href="http://www.allegro.cc/manual/al_destroy_bitmap"><span class="a">al_destroy_bitmap</span></a><span class="k2">(</span>bitmap<span class="k2">)</span><span class="k2">;</span>
<span class="number"> 17</span>
<span class="number"> 18</span>   <span class="k1">return</span> obtained_color<span class="k2">;</span>
<span class="number"> 19</span><span class="k2">}</span>
</div></div><p>

Note that you could also get the <i>alpha</i> color value if you use <span class="source-code"><a href="http://www.allegro.cc/manual/al_map_rgba"><span class="a">al_map_rgba</span></a></span>, or you can get the values as <span class="source-code"><span class="k1">float</span></span>s rather than <span class="source-code"><span class="k1">unsigned</span> <span class="k1">char</span></span>s with the <span class="source-code"><a href="http://www.allegro.cc/manual/al_map_rgba_f"><span class="a">al_map_rgba_f</span></a></span>, and  <span class="source-code"><a href="http://www.allegro.cc/manual/al_map_rgb_f"><span class="a">al_map_rgb_f</span></a></span> variations. <img src="http://www.allegro.cc/forums/smileys/smiley.gif" alt=":)" /></p><h3>Writing color data to a file</h3><p>

If you&#39;re using C++, writing data to a file is relatively simple.</p><div class="source-code"><div class="toolbar"><span class="button numbers"><b>#</b></span><span class="button select">Select</span><span class="button expand">Expand</span></div><div class="inner"><span class="number">  1</span><span class="p">#include &lt;allegro5/allegro_color.h&gt;</span>
<span class="number">  2</span><span class="p">#include &lt;fstream&gt;</span>
<span class="number">  3</span><span class="p">#include &lt;string&gt;</span>
<span class="number">  4</span>
<span class="number">  5</span><span class="k1">bool</span> write_color_to_file<span class="k2">(</span><a href="http://www.allegro.cc/manual/ALLEGRO_COLOR"><span class="a">ALLEGRO_COLOR</span></a> color, std::string filename<span class="k3">=</span><span class="s">"my_color_file.txt"</span><span class="k2">)</span>
<span class="number">  6</span><span class="k2">{</span>
<span class="number">  7</span>   <span class="k1">unsigned</span> <span class="k1">char</span> r<span class="k2">;</span>
<span class="number">  8</span>   <span class="k1">unsigned</span> <span class="k1">char</span> g<span class="k2">;</span>
<span class="number">  9</span>   <span class="k1">unsigned</span> <span class="k1">char</span> b<span class="k2">;</span>
<span class="number"> 10</span>
<span class="number"> 11</span>   <span class="c">// get the color</span>
<span class="number"> 12</span>
<span class="number"> 13</span>   <a href="http://www.allegro.cc/manual/al_unmap_rgb"><span class="a">al_unmap_rgb</span></a><span class="k2">(</span>color, <span class="k3">&amp;</span>r, <span class="k3">&amp;</span>g, <span class="k3">&amp;</span>b<span class="k2">)</span><span class="k2">;</span>  <span class="c">// will "fill" r, g, and b with that color's value.</span>
<span class="number"> 14</span>
<span class="number"> 15</span>   <span class="c">// write the values to a file</span>
<span class="number"> 16</span>
<span class="number"> 17</span>   std::ofstream outfile<span class="k2">(</span>filename<span class="k2">)</span><span class="k2">;</span>  <span class="c">// ofstream is an "output file" stream</span>
<span class="number"> 18</span>   outfile <span class="k3">&lt;</span><span class="k3">&lt;</span> r <span class="k3">&lt;</span><span class="k3">&lt;</span> <span class="s">" "</span> <span class="k3">&lt;</span><span class="k3">&lt;</span> g <span class="k3">&lt;</span><span class="k3">&lt;</span> <span class="s">" "</span> <span class="k3">&lt;</span><span class="k3">&lt;</span> b <span class="k3">&lt;</span><span class="k3">&lt;</span> std::endl<span class="k2">;</span>
<span class="number"> 19</span>   outfile.close<span class="k2">(</span><span class="k2">)</span><span class="k2">;</span>
<span class="number"> 20</span>
<span class="number"> 21</span>   <span class="k1">return</span> <span class="k1">true</span><span class="k2">;</span>
<span class="number"> 22</span><span class="k2">}</span>
</div></div><p>

There are a lot of optimizations you could make with these functions - for example, if you wanted to store multiple color values to a file you might fold <span class="source-code">get_image_color_at<span class="k2">(</span><span class="k2">)</span></span> and <span class="source-code">write_color_to_file<span class="k2">(</span><span class="k2">)</span></span> together (and possibly add a loop).  Ideally, you should only open an <span class="source-code"><a href="http://www.allegro.cc/manual/ALLEGRO_BITMAP"><span class="a">ALLEGRO_BITMAP</span></a></span> once.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Mark Oates)</author>
		<pubDate>Tue, 15 Aug 2017 06:51:47 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Sorry late reply guys. Mark Oates, let me make self very very clear now, the function in allegro 5 lib &quot;al_set_config_value()&quot; takes a const char* as it&#39;s last parameter which is for the value to be written to a configuration file. The function &quot;al_unmap_rgb()&quot; takes unsigned char for the last 3 parameters, which are red, green and blue value of a pixel. Now my compiler &quot;code::blocks v16.01&quot; gives an error in the function that &quot;it cannot convert unsigned char to const char*&quot;. Now how to solve that one. That&#39;s the problem I&#39;ve been facing since LennyLen and Arthur Kalliokoski first replied. Please me with this problem.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (divyesh ladva)</author>
		<pubDate>Sun, 20 Aug 2017 13:24:54 +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/616987/1032238#target">divyesh ladva</a> said:</div><div class="quote"><p> &quot;it cannot convert unsigned char to const char*&quot;  </p></div></div><p>It&#39;s asking for a char <b>pointer</b>, which is not a char, but a pointer to a char.</p><p>What al_unmap_rgb() returns are certainly chars, but it would be better to think of them as bytes, rather than chars, which seems to hint that they&#39;re printable characters.  </p><p>What you need is to &quot;print&quot; the values of those unsigned chars to a char buffer, then point your al_set_config_value() at that buffer.  </p><div class="source-code"><div class="toolbar"><span class="button numbers"><b>#</b></span><span class="button select">Select</span><span class="button expand">Expand</span></div><div class="inner"><span class="number">  1</span><span class="p">#include &lt;stdio.h&gt;</span>
<span class="number">  2</span><span class="p">#include &lt;allegro5/allegro5.h&gt;</span>
<span class="number">  3</span>
<span class="number">  4</span>
<span class="number">  5</span><span class="k1">int</span> main<span class="k2">(</span><span class="k1">void</span><span class="k2">)</span>
<span class="number">  6</span><span class="k2">{</span>
<span class="number">  7</span>  <span class="k1">char</span> buffer<span class="k2">[</span><span class="n">256</span><span class="k2">]</span><span class="k2">;</span>
<span class="number">  8</span>  <a href="http://www.allegro.cc/manual/ALLEGRO_COLOR"><span class="a">ALLEGRO_COLOR</span></a> color<span class="k2">;</span>
<span class="number">  9</span>  <a href="http://www.allegro.cc/manual/ALLEGRO_CONFIG"><span class="a">ALLEGRO_CONFIG</span></a> myconfig<span class="k2">;</span>
<span class="number"> 10</span>  <span class="k1">unsigned</span> <span class="k1">char</span> mysection<span class="k2">[</span><span class="n">20</span><span class="k2">]</span><span class="k2">;</span>
<span class="number"> 11</span>  <span class="k1">unsigned</span> <span class="k1">char</span> mykey<span class="k2">[</span><span class="n">20</span><span class="k2">]</span><span class="k2">;</span>
<span class="number"> 12</span>  <span class="k1">unsigned</span> <span class="k1">char</span> r, g, b<span class="k2">;</span>
<span class="number"> 13</span>
<span class="number"> 14</span>  <a href="http://www.allegro.cc/manual/al_unmap_rgb"><span class="a">al_unmap_rgb</span></a><span class="k2">(</span>color, <span class="k3">&amp;</span>r, <span class="k3">&amp;</span>g, <span class="k3">&amp;</span>b<span class="k2">)</span><span class="k2">;</span>
<span class="number"> 15</span>  <a href="http://www.delorie.com/djgpp/doc/libc/libc_737.html" target="_blank">sprintf</a><span class="k2">(</span>buffer, <span class="s">"%u %u %u\n"</span>,r,g,b<span class="k2">)</span><span class="k2">;</span>
<span class="number"> 16</span>  <a href="http://www.allegro.cc/manual/al_set_config_value"><span class="a">al_set_config_value</span></a><span class="k2">(</span>myconfig, mysection, mykey, buffer<span class="k2">)</span><span class="k2">;</span>
<span class="number"> 17</span>  <span class="k1">return</span> <span class="n">0</span><span class="k2">;</span>
<span class="number"> 18</span><span class="k2">}</span>
</div></div><p>

Now I can&#39;t get the above to compile because it doesn&#39;t know the size of ALLEGRO_CONFIG or something, but it should get you closer to what you want.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Arthur Kalliokoski)</author>
		<pubDate>Sun, 20 Aug 2017 22:59:18 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>The best way to get help with this kind of problem is to post the exact error message text and ideally the code (or a shortened subset of the code) suffering from the error so that we don&#39;t have to go out of our way to invent a program that&#39;s nothing like what you&#39;re doing.</p><p>Looks like there&#39;s an example program (ex_config) that demonstrates it, and the source for that is available here by clicking on &quot;ex_config&quot;:</p><p><a href="https://www.allegro.cc/manual/5/al_set_config_value">https://www.allegro.cc/manual/5/al_set_config_value</a>
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (bamccaig)</author>
		<pubDate>Mon, 21 Aug 2017 05:59:40 +0000</pubDate>
	</item>
</rss>
