mirror of
				https://github.com/OpenMW/openmw.git
				synced 2025-11-04 01:56:44 +00:00 
			
		
		
		
	
		
			
				
	
	
		
			41 lines
		
	
	
	
		
			714 B
		
	
	
	
		
			C++
		
	
	
	
	
	
			
		
		
	
	
			41 lines
		
	
	
	
		
			714 B
		
	
	
	
		
			C++
		
	
	
	
	
	
#include "../servers/outfile_stream.hpp"
 | 
						|
#include <iostream>
 | 
						|
 | 
						|
using namespace Mangle::Stream;
 | 
						|
using namespace std;
 | 
						|
 | 
						|
void print(Stream &str)
 | 
						|
{
 | 
						|
  cout << "size=" << str.size()
 | 
						|
       << " pos=" << str.tell()
 | 
						|
       << " eof=" << str.eof()
 | 
						|
       << endl;
 | 
						|
}
 | 
						|
 | 
						|
int main()
 | 
						|
{
 | 
						|
  {
 | 
						|
    cout << "\nCreating file\n";
 | 
						|
    OutFileStream out("test.file");
 | 
						|
    print(out);
 | 
						|
    out.write("hello",5);
 | 
						|
    print(out);
 | 
						|
  }
 | 
						|
 | 
						|
  {
 | 
						|
    cout << "\nAppending to file\n";
 | 
						|
    OutFileStream out("test.file", true);
 | 
						|
    print(out);
 | 
						|
    out.write(" again\n",7);
 | 
						|
    print(out);
 | 
						|
  }
 | 
						|
 | 
						|
  {
 | 
						|
    cout << "\nOverwriting file\n";
 | 
						|
    OutFileStream out("test.file");
 | 
						|
    print(out);
 | 
						|
    out.write("overwrite!\n",11);
 | 
						|
    print(out);
 | 
						|
  }
 | 
						|
  return 0;
 | 
						|
}
 |