Скачиваний:
62
Добавлен:
01.05.2014
Размер:
715 б
Скачать
// 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