Updated PCI IDs to latest snapshot.
[tangerine.git] / test / setfilesize.c
blob608d2ba964386287a60f2f236e4e4eecf669ec07
1 #include <exec/types.h>
2 #include <dos/dosextens.h>
3 #include <dos/bptr.h>
4 #include <proto/exec.h>
5 #include <proto/dos.h>
6 #include <stdio.h>
7 #include <string.h>
8 #include <stdlib.h>
10 int main(int argc, char **argv) {
11 BPTR fh;
12 LONG size;
14 if (argc != 3) {
15 printf("usage: %s filename newsize\n", argv[0]);
16 return 1;
19 fh = Open(argv[1], MODE_READWRITE);
20 if (fh == NULL) {
21 PrintFault(IoErr(), "SetFileSize");
22 return 0;
25 size = SetFileSize(fh, atol(argv[2]), OFFSET_BEGINNING);
26 if (size < 0) {
27 PrintFault(IoErr(), "SetFileSize");
28 Close(fh);
29 return 0;
32 Printf("New size is %ld bytes\n", size);
34 Close(fh);
36 return 0;