slang-users mailing list

[2005 Date Index] [2005 Thread Index] [Other years]
[Thread Prev] [Thread Next]      [Date Prev] [Date Next]

[slang-users] Data type


Hello,

I don't understand well how datas are converted from one type to another.
For example :

i = 65;
fwrite (i, fp);

The resulting file is :

0x00000000: 41000000                                A...

i = 65Uh ;
fwrite (i, fp);

The resulting file is :

0x00000000: 4100                                    A.

i = 65;
typecast (i, UChar_Type);
fwrite (i, fp);

The resulting file is :

0x00000000: 41000000                                A...

i = 65;
fwrite (pack("C",i), fp);

The resulting file is :

0x00000000: 41                                      A


This is probably a stupid question but could anybody please explain me
the "typecast ()" behavior ? Thanks.

Regards ;


Laurent.

_______________________________________________
To unsubscribe, visit http://jedsoft.org/slang/mailinglists.html


[2005 date index] [2005 thread index]
[Thread Prev] [Thread Next]      [Date Prev] [Date Next]