2 Copyright © 1995-2015, The AROS Development Team. All rights reserved.
6 #include <exec/types.h>
8 #include <proto/exec.h>
14 int main(int argc
, char **argv
)
17 LONG result
= RETURN_OK
, error
= 0, size
;
18 struct FileInfoBlock
*fib
;
20 fib
= AllocDosObject(DOS_FIB
, NULL
);
27 if (error
== 0 && argc
!= 3)
29 printf("Usage: %s filename newsize\n", argv
[0]);
30 error
= ERROR_REQUIRED_ARG_MISSING
;
36 fh
= Open(argv
[1], MODE_READWRITE
);
40 result
= RETURN_ERROR
;
47 if (SetFileSize(fh
, atol(argv
[2]), OFFSET_BEGINNING
) != size
)
50 result
= RETURN_ERROR
;
56 if (!ExamineFH(fh
, fib
))
59 result
= RETURN_ERROR
;
65 Printf("New size is %ld bytes\n", fib
->fib_Size
);
66 if (fib
->fib_Size
!= size
)
68 if (fib
->fib_Size
> size
)
69 error
= ERROR_OBJECT_TOO_LARGE
;
71 error
= ERROR_UNKNOWN
;
72 result
= RETURN_ERROR
;
77 FreeDosObject(DOS_FIB
, fib
);
81 PrintFault(error
, "SetFileSize");