mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-01-10 15:39:02 +00:00
42 lines
714 B
C++
42 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;
|
|
}
|