C/C++

unsigned short chunk_id;	// 
unsigned int chunk_len;		// 

//    ,  ifs   
ifstream ifs;

//    fname,          
ifs.open(fname.c_str(), ios_base::in | ios_base::binary | ios_base::beg);

ifs.is_open();	// ?

//    chunk_id 2 ;
//   "(char*)&"          
ifs.read((char*)&chunk_id,2);

// chunk_len-6 ;    chunk_len-6  
ifs.ignore(chunk_len-6);

//     ifs.tellg()-6
ifs.seekg(ifs.tellg()-6);

//    
ifs.tellg();

// ?
ifs.eof();

. read write ">>" "<<"

, << >>. , TEST , , , .

#include <iostream.h>
#include <fstream.h>

int main()
{
	ofstream out("test");
	if(!out) {
		cout << "He   .\n\";
		return 1;
	}

	//  .
	out << 10 << " " << 123.23 << "\n";
	out << "   .\n";
	out.closet();

	//   ,   ,
	char ch;
	int i;
	float f;
	char str [80];

	ifstream in("test");
	if(!in) {
		cout << "He   .\n";
		return 1;
	}

	in >> i ;
	in >> f;
	in >> ch;
	in >> str;

	cout << "  : ";
	cout << i << " " << f <<" " << ch << "\n";
	cout << str;

	in.close();

	return 0;
}

>> , . , . , - -.






Нет комментариев.



Оставить комментарий:
Ваше Имя:
Email:
Антибот: *  
Ваш комментарий: