use consistent cpu naming & numbering
[AROS.git] / test / setfilesize.c
blob172a15bffcf3bb64991d57171ca41477b1a02218
1 /*
2 Copyright © 1995-2014, The AROS Development Team. All rights reserved.
3 $Id$
4 */
6 #include <exec/types.h>
7 #include <dos/dosextens.h>
8 #include <dos/bptr.h>
9 #include <proto/exec.h>
10 #include <proto/dos.h>
11 #include <stdio.h>
12 #include <string.h>
13 #include <stdlib.h>
15 int main(int argc, char **argv) {
16 BPTR fh;
17 LONG size;
19 if (argc != 3) {
20 printf("usage: %s filename newsize\n", argv[0]);
21 return 1;
24 fh = Open(argv[1], MODE_READWRITE);
25 if (fh == BNULL) {
26 PrintFault(IoErr(), "SetFileSize");
27 return 0;
30 size = SetFileSize(fh, atol(argv[2]), OFFSET_BEGINNING);
31 if (size < 0) {
32 PrintFault(IoErr(), "SetFileSize");
33 Close(fh);
34 return 0;
37 Printf("New size is %ld bytes\n", size);
39 Close(fh);
41 return 0;