тороны пользователя. Некоторые

Автор admin Вторник, 12 мая 2009 11:32

тороны пользователя. Некоторые версии обычных функций файлового ввода-вывода должны быть оформлены в виде функций класса, чтобы все, что делается с файлом средствами С, также могло делаться при помощи класса С++: //: C04:Fullwrap.h // Полная инкапсуляция файлового ввода-вывода #ifndef FULLWRAP_H #define FULLWRAP_H #include #include #undef getc #undef putc #undef ungetc using std::size_t; using std::fpos_t: class File { std: std: FILE* f: FILE* F(); // Возвращает проверенный указатель на f public: FileO; // Создает объект, но не открывает файл FileCconst char* path, const char* mode = “r”); -FileO: int open(const char* path, const char* mode = “r”): int reopen(const char* path, const char* mode); int getcO; int ungetc(int c): int putc(int c): int puts(const char* s); char* gets(char* s. int n): int printf(const char* format, …): size_t read(void* ptr. size_t size, size_t n); size_t write(const void* ptr. size_t size. size_t n): int eof(): 130 Глава 4 • Потоки ввода-вывода int closeO: int flushO: int seek(long offset, int whence): int getpos(fpos_t* pos): int setpos(const fpos_t* po


Комментарии закрыты.