| ex8-4.cpp - Example 8-4 ostream member functions |
// File: ex8-4.cpp - ostream member functions: put() and write()
#include <iostream>
using namespace std;
struct stuff {
int a;
short b;
long c;
float d;
double e;
char f;
char* g;
char h[16];
};
int main(void)
{
char text[] = "The quick brown fox jumped over the lazy poodle";
for (int i = 0; i< 20; i++) {
cout.put(text[i]);
}
cout.put('\n');
cout.write(text,sizeof(text));
cout << endl;
stuff thing;
thing.a = 57;
thing.b = 98;
thing.c = 123456789;
thing.d = 1.2;
thing.e = 2.7;
thing.f = '*';
thing.g = text;
strcpy(thing.h,"bet the farm");
cout.write((char*)&thing,sizeof(thing));
cout << endl;
return 0;
}