Добавил:
Studfiles2
Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз:
Предмет:
Файл:Курсовая по ООП2 / prj3 / prj3
.cpp// prj3.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include "ifile.h"
#include "ofile.h"
#include "iofile.h"
#include <iostream.h>
int main(int argc, char* argv[])
{
char *fileName = "data.txt"; // Имя файла
// Открываем файл на чтение и запись
IOFile *iof = new IOFile(fileName);
// Пишем в файл
iof->write(1223);
iof->write('a');
// Уничтожаем iof. Файл при этом закрывается
delete iof;
// Заново открываем тот-же самый файл
iof = new IOFile(fileName);
int i;
char c;
// Читаем данные, которые перед этим записали
iof->read(i);
iof->read(c);
cout << i << endl;
cout << c << endl;
delete iof;
getchar();
return 0;
}
Соседние файлы в папке prj3