Back to index

tetex-bin  3.0
c-fopen.h
Go to the documentation of this file.
00001 /* c-fopen.h: how to open files with fopen.
00002 
00003 Copyright (C) 1992, 94, 95, 96, 2000 Free Software Foundation, Inc.
00004 
00005 This library is free software; you can redistribute it and/or
00006 modify it under the terms of the GNU Library General Public
00007 License as published by the Free Software Foundation; either
00008 version 2 of the License, or (at your option) any later version.
00009 
00010 This library is distributed in the hope that it will be useful,
00011 but WITHOUT ANY WARRANTY; without even the implied warranty of
00012 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00013 Library General Public License for more details.
00014 
00015 You should have received a copy of the GNU Library General Public
00016 License along with this library; if not, write to the Free Software
00017 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
00018 
00019 #ifndef C_FOPEN_H
00020 #define C_FOPEN_H
00021 
00022 /* How to open a text file:  */
00023 #ifndef FOPEN_A_MODE
00024 #define FOPEN_A_MODE "a"
00025 #endif
00026 
00027 #ifndef FOPEN_R_MODE
00028 #define FOPEN_R_MODE "r"
00029 #endif
00030 
00031 #ifndef FOPEN_W_MODE
00032 #define FOPEN_W_MODE "w"
00033 #endif
00034 
00035 /* How to open a binary file for reading:  */
00036 #ifndef FOPEN_RBIN_MODE
00037 #define       FOPEN_RBIN_MODE      "rb"
00038 #endif /* not FOPEN_RBIN_MODE */
00039 
00040 /* How to open a binary file for writing:  */
00041 #ifndef FOPEN_WBIN_MODE
00042 #define FOPEN_WBIN_MODE "wb"
00043 #endif /* not FOPEN_WBIN_MODE */
00044 
00045 /* How to open a binary file for appending:  */
00046 #ifndef FOPEN_ABIN_MODE
00047 #define FOPEN_ABIN_MODE "ab"
00048 #endif /* not FOPEN_ABIN_MODE */
00049 
00050 /* How to switch an already open file handle to binary mode.
00051    Used on DOSISH systems when we need to switch a standard
00052    stream, such as stdin or stdout, to binary mode.  */
00053 #include <fcntl.h>
00054 #ifdef DOSISH
00055 #include <io.h>
00056 #ifndef O_BINARY
00057 #ifdef _O_BINARY
00058 #define O_BINARY _O_BINARY
00059 #endif
00060 #endif
00061 #if defined (__i386_pc_gnu__) || \
00062     defined (WIN32) || defined (__WIN32__) || defined (_WIN32)
00063 #define SET_BINARY(f) setmode((f), O_BINARY)
00064 #endif
00065 #else  /* not DOSISH */
00066 #ifndef O_BINARY
00067 #define O_BINARY 0
00068 #endif
00069 #define SET_BINARY(f) 0
00070 #endif /* not DOSISH */
00071 
00072 #endif /* not C_FOPEN_H */