Odamex
Setting the Standard in Multiplayer Doom
common/m_memio.h
Go to the documentation of this file.
00001 // Emacs style mode select   -*- C++ -*- 
00002 //-----------------------------------------------------------------------------
00003 //
00004 // $Id: m_memio.h 1788 2010-08-24 04:42:57Z russellrice $
00005 //
00006 // Copyright (C) 1993-1996 by id Software, Inc.
00007 // Copyright (C) 2005 by Simon Howard
00008 // Copyright (C) 2006-2010 by The Odamex Team
00009 //
00010 // This program is free software; you can redistribute it and/or
00011 // modify it under the terms of the GNU General Public License
00012 // as published by the Free Software Foundation; either version 2
00013 // of the License, or (at your option) any later version.
00014 //
00015 // This program is distributed in the hope that it will be useful,
00016 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00017 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00018 // GNU General Public License for more details.
00019 //
00020 // DESCRIPTION:
00021 //      [Russell] - Added some functions and cleaned up a few areas
00022 //    
00023 //-----------------------------------------------------------------------------
00024 
00025 
00026 #ifndef MEMIO_H
00027 #define MEMIO_H
00028 
00029 // returns the length of an "c array" on the stack.
00030 #define STACKARRAY_LENGTH(a) ((sizeof(a) / sizeof(a[0])))
00031 
00032 typedef struct _MEMFILE MEMFILE;
00033 
00034 typedef enum 
00035 {
00036         MEM_SEEK_SET,
00037         MEM_SEEK_CUR,
00038         MEM_SEEK_END
00039 } mem_rel_t;
00040 
00041 MEMFILE *mem_fopen_read(void *buf, size_t buflen);
00042 size_t mem_fread(void *buf, size_t size, size_t nmemb, MEMFILE *stream);
00043 MEMFILE *mem_fopen_write(void);
00044 size_t mem_fwrite(const void *ptr, size_t size, size_t nmemb, MEMFILE *stream);
00045 void mem_get_buf(MEMFILE *stream, void **buf, size_t *buflen);
00046 void mem_fclose(MEMFILE *stream);
00047 long mem_ftell(MEMFILE *stream);
00048 int mem_fseek(MEMFILE *stream, signed long offset, mem_rel_t whence);
00049 size_t mem_fsize(MEMFILE *stream); // [Russell] - get size of stream
00050 char *mem_fgetbuf(MEMFILE *stream); // [Russell] - return stream buffer
00051 #endif /* #ifndef MEMIO_H */
00052           
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends