open()
#include <fstream> void fstream::open(const char *filename, ios::openmode mode = ios::in | ios::out); void ifstream::open(const char *filename, ios::openmode mode = ios::in); void ofstream::open(const char *filename, ios::openmode mode = ios::out | ios::trunc);
��������
��������� ���� � �������
������� �������� ������ ������� fstream, ifstream � ofstream. � ������� ������� open() ���� ����������� � �������. �������� filename �������� ��� ����� � ����� �������� ������������ ����. �������� ��������� mode ����������, � ����� ������ ����������� ����. ���� ����������� ��������� �������� ����� ���������.
��������� �������� ���(OR), ����� ���������� � ����� ��������� ��� ��� ������ ��������(�� ������������� ����). ������� �������� ios::���, ����� ���������� ���������� ���� ��������� ������ � ����� ��������� �����. ��� �������� ����� ������������ ������ � �������, ������� ��������� ��������� �������� ������. ��������� �������� ios::ate ��������� ���������� ��������� � ����� ����� ��� ��� ��������, �� �������� �� ��� �������� �����-������ ����� ����������� � ����� ����� �����. �������� ios::binary ������������ ����������� ��������� ���� ��� ���������� �������� �������� �����-������. �� ��������� ����� ����������� � ��������� ������. �������� ios::in ��������� �� ����������� ����� � ���������� �������� �����, � �������� ios::out � �������� ������. ������ �������� ������ ifstream ���� �� ���� ������������ ����, �������� ������ ofstream � �����, � �������� ����� � �������������� ������ fstream � ��� ����, ��� � �����. ������������� �������� ios::trunc �������� � ���������� ����������� ��� ������������� ����� � ����� �� ������, � ��� ���� ��������� �� ������� �����. �� ���� �������, ���� ������� open() ����������� ��������, ����� ����� �������� false. �������������, ������ ��� ������������ ����, ���������� ��������� � ���, ��� �� ��� ������� ������. |
Нет комментариев. Оставить комментарий: |