http://www.ousob.com --- Legacy Redefined #include <stdlib.h> #include <fcntl.h> #include <io.h> #include <extend50.h> #define open _topen #define close _tclose #define lseek _tlseek #define read _tread #define write _twrite #define create _tcreat extern int _topen( char*, int); extern int _tclose( int ); extern long _tlseek( int, long, int); extern int _tread( int, char*, int); extern int _twrite( int, char*, int); extern int _tcreat( char*, int); CLIPPER b_seek() { int gotAproblem = 0 ; long newPos = -1 ; int fileHandle = _parni(1); long offSet = _parnl(2); int seekFrom = _parni(3); if( !ISNUM(1) || !ISNUM(2) || !ISNUM(3) ){ gotAproblem = 1; } if( seekFrom < 0 || seekFrom > 2 ){ /* 0 seek from beginning of file */ /* 1 seek from current position */ gotAproblem = 1; /* 2 seek from end of file */ } if( !gotAproblem ){ newPos = lseek(fileHandle,offSet,seekFrom); } _retnl(newPos); }