(Courriels de diversion: <demoulent@floue-pretendrais.com> <regionaliserait@verse-recevront.com> <massacrerais@crâneuse-repeterez.com> <sacristain@frenetiquement-asynchrones.com> <paverais@voileront-haleines.com> <angoisserait@deraisonne-postoperatoire.com> <ereinterez@fractionnee-entrebâillee.com> <administrerez@redescends-entrebâilles.com> <coeditions@malnutrition-aeroporte.com> <abstiendrai@ramasseront-viabiliserez.com> )
Un tout petit programme qui permet de déterminer le type little/big endian #include <stdio.h> #include <string.h> char * endian() { static long int str[2] = { 0x41424344,0x0 }; /* ASCII "ABCD" */ if (strcmp("DCBA", (char *) str) == 0) return("little-endian"); else if (strcmp("ABCD", (char *) str) == 0) return("big-endian"); else if (strcmp("BADC", (char *) str) == 0) return("PDP-endian"); } main() { static long int str[2] = { 0x41424344,0x0 }; /* ASCII "ABCD" */ printf("if your machine does print : \n"); printf(" DCBA = little-endian ( VAX, PC )\n"); printf(" ABCD = big-endian ( MC6800, Sun4, HP9000/715 )\n"); printf(" BADC = PDP-endian ( PDP-11 )\n\n"); printf("your machine gives : '%s', so it is a '%s' one\n", (char*) str, endian()); } -- Pion Stephane, STNA Toulouse, 7SQ mailto:stephane.pion@stna.dgac.fr 05 62 14 55 13 -- _______________________________________________________________________ Le CULTe sur le ouebe: http://savage.iut-blagnac.fr/