2 Copyright © 2003, The AROS Development Team. All rights reserved.
15 BPTR
FILE_Open( CONST_STRPTR path
, LONG mode
)
17 LONG mode2dos
[] = { MODE_OLDFILE
, MODE_NEWFILE
};
20 if( mode
!= MODE_READ
&& mode
!= MODE_WRITE
);
22 file
= Open( path
, mode2dos
[mode
] );
23 if( file
== BNULL
) goto error
;
25 Seek( file
, 0, OFFSET_END
);
26 file_size
= Seek( file
, 0, OFFSET_BEGINNING
) + 1;
34 LONG
FILE_Read( BPTR file
, APTR buffer
, LONG length
)
39 while( read
< length
)
41 LONG actual
= Read( file
, buffer
, left
);
42 if( actual
== -1 ) return -1;
48 GUI_Update( Seek( file
, 0, OFFSET_CURRENT
), file_size
);
50 if( actual
== 0 ) break;
56 LONG
FILE_Write( BPTR file
, CONST_APTR buffer
, LONG length
)
61 while( written
< length
)
63 LONG actual
= Write( file
, buffer
, left
);
64 if( actual
== -1 ) return -1;