[ale] Stupid question

Fulton Green ale at FultonGreen.com
Mon Oct 29 18:12:30 EST 2001


The question itself wasn't stupid, but leaving out the name of your
development language was. ;-)

If this is C/C++, that "int" needs to be a "char" instead, and IIRC, should
actually be a "short char", as some 32-bit platforms may try to use 16 bits
(i.e., 2 bytes) for the character representation.

It would also help to know which function you're using to write the structure
out, as well as how you're using it.

On Mon, Oct 29, 2001 at 05:55:13PM -0500, Christopher Fowler wrote:
> When I write the folling:
> 
> int c ='A'
> 
> to a file, the file is 4 bytes in size.  In realsity that value could be
> stored in one byte.
> 
> When I look at the file, it looks like this:
> 
> A	NULL		NULL		NULL
> 
> using octal dump with the ascii option.  I'm trying to build a config file
> that is created from
> a sturcture of values.  The structure is very big.  My calculations of
> locations were so wrong due to
> ths size of an interger being 4 bytes on my machine.  Is there a way to make
> the interger actually
> 1 byte so that the only thing in the file is A.

---
This message has been sent through the ALE general discussion list.
See http://www.ale.org/mailing-lists.shtml for more info. Problems should be 
sent to listmaster at ale dot org.






More information about the Ale mailing list