Unless you need to save space, you could just declare the string as a character array of a fixed size, then write out the whole buffer. When you read it back it, it will have the string terminator. This is also good if you write out a structure which has data of different types.
Code:
#include <stdlib.h>
#include <fstream.h>
int main()
{
int i;
char city[80];
char cities[10][80] =
{"Dallas","Paris","Rome","Las Vegas","London",
"Athens","Los Angeles","San Diego","Madrid","Tampa Bay"};
remove("cities.dat");
ofstream out("cities.dat",ios::binary);
for (i=0; i<10; i++)
out.write(cities[i],80);
out.close();
ifstream in("cities.dat",ios::binary);
for (i=0; i<10; i++)
{
in.read(city,80);
cout << "city:" << city << "...\n";
}
in.close();
return 0;
}