1// Copyright (C) 2016 and later: Unicode, Inc. and others. 2// License & terms of use: http://www.unicode.org/copyright.html 3/* 4****************************************************************************** 5* 6* Copyright (C) 1997-2005, International Business Machines 7* Corporation and others. All Rights Reserved. 8* 9****************************************************************************** 10* 11* File FILESTRM.H 12* 13* Contains FileStream interface 14* 15* @author Glenn Marcy 16* 17* Modification History: 18* 19* Date Name Description 20* 5/8/98 gm Created. 21* 03/02/99 stephen Reordered params in ungetc to match stdio 22* Added wopen 23* 24****************************************************************************** 25*/ 26 27#ifndef FILESTRM_H 28#define FILESTRM_H 29 30#include "unicode/utypes.h" 31 32typedef struct _FileStream FileStream; 33 34U_CAPI FileStream* U_EXPORT2 35T_FileStream_open(const char* filename, const char* mode); 36 37/* 38U_CAPI FileStream* U_EXPORT2 39T_FileStream_wopen(const wchar_t* filename, const wchar_t* mode); 40*/ 41U_CAPI void U_EXPORT2 42T_FileStream_close(FileStream* fileStream); 43 44U_CAPI UBool U_EXPORT2 45T_FileStream_file_exists(const char* filename); 46 47/* 48U_CAPI FileStream* U_EXPORT2 49T_FileStream_tmpfile(void); 50*/ 51 52U_CAPI int32_t U_EXPORT2 53T_FileStream_read(FileStream* fileStream, void* addr, int32_t len); 54 55U_CAPI int32_t U_EXPORT2 56T_FileStream_write(FileStream* fileStream, const void* addr, int32_t len); 57 58U_CAPI void U_EXPORT2 59T_FileStream_rewind(FileStream* fileStream); 60 61/*Added by Bertrand A. D. */ 62U_CAPI char * U_EXPORT2 63T_FileStream_readLine(FileStream* fileStream, char* buffer, int32_t length); 64 65U_CAPI int32_t U_EXPORT2 66T_FileStream_writeLine(FileStream* fileStream, const char* buffer); 67 68U_CAPI int32_t U_EXPORT2 69T_FileStream_putc(FileStream* fileStream, int32_t ch); 70 71U_CAPI int U_EXPORT2 72T_FileStream_getc(FileStream* fileStream); 73 74U_CAPI int32_t U_EXPORT2 75T_FileStream_ungetc(int32_t ch, FileStream *fileStream); 76 77U_CAPI int32_t U_EXPORT2 78T_FileStream_peek(FileStream* fileStream); 79 80U_CAPI int32_t U_EXPORT2 81T_FileStream_size(FileStream* fileStream); 82 83U_CAPI int U_EXPORT2 84T_FileStream_eof(FileStream* fileStream); 85 86U_CAPI int U_EXPORT2 87T_FileStream_error(FileStream* fileStream); 88 89/* 90U_CAPI void U_EXPORT2 91T_FileStream_setError(FileStream* fileStream); 92*/ 93 94U_CAPI FileStream* U_EXPORT2 95T_FileStream_stdin(void); 96 97U_CAPI FileStream* U_EXPORT2 98T_FileStream_stdout(void); 99 100U_CAPI FileStream* U_EXPORT2 101T_FileStream_stderr(void); 102 103U_CAPI UBool U_EXPORT2 104T_FileStream_remove(const char* fileName); 105 106#endif /* _FILESTRM*/ 107