00001 // ZenLib::FileB - standart files functions 00002 // Copyright (C) 2002-2003 Jérôme Martinez, Zen@MediaArea.net 00003 // 00004 // This software is provided 'as-is', without any express or implied 00005 // warranty. In no event will the authors be held liable for any damages 00006 // arising from the use of this software. 00007 // 00008 // Permission is granted to anyone to use this software for any purpose, 00009 // including commercial applications, and to alter it and redistribute it 00010 // freely, subject to the following restrictions: 00011 // 00012 // 1. The origin of this software must not be misrepresented; you must not 00013 // claim that you wrote the original software. If you use this software 00014 // in a product, an acknowledgment in the product documentation would be 00015 // appreciated but is not required. 00016 // 2. Altered source versions must be plainly marked as such, and must not be 00017 // misrepresented as being the original software. 00018 // 3. This notice may not be removed or altered from any source distribution. 00019 // 00020 //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 00021 //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 00022 // File 00023 //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 00024 // 00025 // Version 0.0.1 00026 // ------------- 00027 // 00028 // 00029 //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 00030 //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 00031 // 00032 // 0.0.1 00033 // 00034 // 00035 //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 00036 00037 //--------------------------------------------------------------------------- 00038 #ifndef ZenFileBH 00039 #define ZenFileBH 00040 //--------------------------------------------------------------------------- 00041 00042 //--------------------------------------------------------------------------- 00043 #include <ZenLib/File_.h> 00044 #include <stdio.h> 00045 //--------------------------------------------------------------------------- 00046 00047 namespace ZenLib 00048 { 00049 00050 //*************************************************************************** 00051 // Classe CFichier_Binaire 00052 //*************************************************************************** 00053 00054 class FileB : public File_ 00055 { 00056 public : 00057 //Gestion de la classe 00058 FileB (); 00059 ~FileB (); 00060 00061 //Ouverture/fermeture 00062 int Ouvrir (const Ztring &Fichier="", bool Nouveau=false, bool Ajout=false, bool Ecriture=false); 00063 void Fermer (); 00064 00065 //Gestion binaire 00066 int Lire(unsigned char* Data, int Taille_Max); 00067 int Lire(unsigned char* Data, int Taille_Max, int Offset, int Whence=SEEK_SET); 00068 int Ecrire (const unsigned char* Data, int Taille); 00069 int Ecrire (const unsigned char* Data, int Taille, int Offset, int Whence=SEEK_SET); 00070 int Lire(char* Data, int Taille_Max); 00071 int Lire(char* Data, int Taille_Max, int Offset, int Whence=SEEK_SET); 00072 int Ecrire (const char* Data, int Taille); 00073 int Ecrire (const char* Data, int Taille, int Offset, int Whence=SEEK_SET); 00074 00075 //Divers 00076 bool Eof(); //Fin de fichier 00077 int Longueur(); //Taille du fichier 00078 static int Supprimer(Ztring Fichier); //Supprimer le fichier 00079 int Position_Get(); //Quelle est la position dans le fichier 00080 int Position_Set(int Offset, int Whence=SEEK_SET); 00081 Ztring Nom_Get(); 00082 00083 protected : 00084 int F; 00085 }; 00086 00087 } //Namespace 00088 00089 #endif