----- Original Message ----- From: "geffroy" <sgeffroy@lasim.univ-lyon1.fr> To: "Fine Valeri" <fine@bnl.gov> Sent: Monday, January 28, 2002 8:57 AM Subject: root under windows > hello > > i'm a root user under win2000 > I would like to use the command : > > Seek_t TFile::SysSeek(Int_t fd, Seek_t offset, Int_t whence) > > but the root manual on-line said that this command use directly the lseek > system command ROOT manual doesn't say this method doesn't work under Windows, or it is for UNIX platform only. (By some reason one doesn't provide any Windows implementation for 64-bits file system. Why ? ) The placement of this method in the TFile class rather TSystem is confusing also. Even though on either platform one can use TFile::SysSeek method as ROOT manual describes the comment there is confusing for Windows user: "All arguments like in "man 2 lseek" ( http://root.cern.ch/root/htmldoc/TFile.html#TFile:SysSeek ) Many Windows users have no idea what the combination of the words above "man 2 lseek" does mean. It suggests this works properly on UNIX platform only. On other hande this method is "protected". This sounds it is not designed to be used by the "regular" user. May be the direct explanation of the parameters is more appropriated: TFile::SysSeek - Interface to system lseek. The method repositions the offset of the file descriptor "fildes" to the argument "offset" according to the directive "whence" as follows: SEEK_SET The offset is set to offset bytes. SEEK_CUR The offset is set to its current location plus offset bytes. SEEK_END The offset is set to the size of the file plus offset bytes. RETURN VALUES Upon successful completion, lseek returns the resulting offset location as measured in bytes from the beginning of the file. Otherwise, a value of (Seek_t)-1 is returned and errno is set to indicate the error. On other hand to use this method it is not enough to provide TFile class header file, namely "TFile.h" one has to provide the platform specific system header files also (Why ?) ( see: TFile.cxx file http://root.cern.ch/root/htmldoc/src/TFile.cxx.html) namely: #include <fcntl.h> #include <errno.h> #include <sys/stat.h> #ifndef WIN32 # include <unistd.h> #else # define ssize_t int # include <io.h> # include <sys/types.h> #endif The comment: "... // except that the offset and return value are Long_t to be able to // handle 64 bit file systems. ..." is still confusing. [rcas6028] /afs/rhic/star/ROOT/3.02.01/include > grep Seek_t *.h Rtypes.h:typedef int Seek_t; //File pointer Rtypes.h:typedef int Seek_t; //File pointer How "int Seek_t" can accomodate 64-bits is unclear. Very likely one may ask the Team to create a "cross-platform" interface for this method. (The right place for such sort of method is TSystem class of course). Some kind of ROOT-specific enumerate statement would be useful also: TFile.h: enum {kSeekSet, kSeekCur, kSeekEnd} EFileSeek; TFile.cxx: static const int gSeekMap[kSeekEnd+1] = {SEEK_SET, SEEK_CUR, SEEK_END}; Seek_t TFile::SysSeek(Int_t fd, Seek_t offset, EFileSeek whence) { #ifndef WIN32 return ::lseek(fd, offset, gSeekMap[whence]); #else return ::lseek64(fd, offset, gSeekMap[whence]); #endif } > my question is what is the equivalent for Win2000 ? For 32-bits file system one can use TFile::SysSeek "as is" for 64-bits one can call the "lseek64" directly Either way under Window you have to provide "#include <io.h>" yourself to get your code compiled. Hope this helps, Valeri > > thank a lot > > ------- > Sylvain Geffroy > http://lasim.univ-lyon1.fr/perso/geffroy/ >
This archive was generated by hypermail 2b29 : Sat Jan 04 2003 - 23:50:40 MET