Main Page | Namespace List | Class Hierarchy | Class List | File List | Namespace Members | Class Members | File Members | Related Pages

fileio.h

Go to the documentation of this file.
00001 /*==========================================================================
00002  * Copyright (c) 2005 University of Massachusetts.  All Rights Reserved.
00003  *
00004  * Use of the Lemur Toolkit for Language Modeling and Information Retrieval
00005  * is subject to the terms of the software license set forth in the LICENSE
00006  * file included with this software, and also available at
00007  * http://www.lemurproject.org/license.html
00008  *
00009  *==========================================================================
00010 */
00011 #ifndef FILEIO_H
00012 #define FILEIO_H
00013 
00014 #ifdef WIN32
00015 #pragma warning( disable : 4133 )
00016   #define NOGDI
00017   #define _WIN32_WINNT 0x0400
00018   #define WIN32_LEAN_AND_MEAN
00019   #include <windows.h>
00020   typedef __int64 FILE_OFFSET;
00021   /* F_HANDLE should have the handle
00022      Keep the position field pending addition of 
00023      buffered io behavior of fread/fwrite.
00024      Otherwise it is unnecessary.
00025   */
00026   typedef struct F_HANDLE {
00027     HANDLE handle;
00028     FILE_OFFSET position;
00029   } F_HANDLE;
00030 /* fopen a file */ 
00031 F_HANDLE *file_open( char *fname, char *mode);
00032 /* fclose a FILE */
00033 void file_close( F_HANDLE *file );
00034 /* fseeko a FILE */
00035 int file_seek( F_HANDLE *file, FILE_OFFSET position, int whence );
00036 /* ftello a FILE */
00037 FILE_OFFSET file_tell( F_HANDLE *file );
00038 /* fread a FILE */
00039 size_t file_read( void* buffer, size_t size, 
00040                   size_t number, F_HANDLE *file );
00041 /* fwrite a file */
00042 size_t file_write( void* buffer, size_t size, 
00043                    size_t number, F_HANDLE *file );
00044 #define fopen file_open
00045 #define fclose file_close
00046 #define fseeko file_seek
00047 #define ftello file_tell
00048 #define fread file_read
00049 #define fwrite file_write
00050 #define FILE F_HANDLE
00051 #else
00052 #include <sys/types.h>
00053 typedef off_t FILE_OFFSET;
00054 #endif
00055 #endif // FILEIO_H

Generated on Tue Jun 15 11:02:54 2010 for Lemur by doxygen 1.3.4