define __KERNEL_STRICT_NAMES to avoid inclusion of kernel types on systems that carry...
[cake.git] / test / alib / betest.c
blob6cd8def2d11734ef46284504d7f44e21446de476
1 /*
2 Copyright © 1995-2001, The AROS Development Team. All rights reserved.
3 $Id$
4 */
6 #include <stdio.h>
7 #include <dos/dos.h>
8 #include <proto/exec.h>
9 #include <proto/dos.h>
10 #include <proto/alib.h>
11 #include <proto/aros.h>
13 int main (int argc, char ** argv)
15 BPTR fh;
16 UBYTE b;
17 UWORD w;
18 ULONG l;
19 FLOAT f;
20 DOUBLE d;
21 STRPTR s = NULL;
23 fh = Open ("test.bed", MODE_NEWFILE);
25 if (!fh)
27 printf ("Couldn't open file (1)\n");
28 return 10;
31 WriteByte (fh, 0x11);
32 WriteWord (fh, 0x1122);
33 WriteLong (fh, 0x11223344);
34 WriteString (fh, "Hello world.");
35 WriteFloat (fh, 1.5);
36 WriteDouble (fh, 1.75);
38 Close (fh);
40 fh = Open ("test.bed", MODE_OLDFILE);
42 if (!fh)
44 printf ("Couldn't open file (2)\n");
45 return 10;
48 ReadByte (fh, &b);
49 kprintf ("Byte = %02x\n", b);
50 ReadWord (fh, &w);
51 kprintf ("Word = %04x\n", w);
52 ReadLong (fh, &l);
53 kprintf ("Long = %08lx\n", l);
54 ReadString (fh, &s);
55 kprintf ("String = \"%s\"\n", s);
56 ReadFloat (fh, &f);
57 kprintf ("Float = %08lx\n", ((ULONG *)&f)[0]);
58 ReadDouble (fh, &d);
59 kprintf ("Double = %08lx%08lx\n", ((ULONG *)&d)[1], ((ULONG *)&d)[0]);
61 FreeVec (s);
63 Close (fh);
65 return 0;