main.cpp/physics.h: add some (somewhat icky) compile fixes for OS X
[openc2e.git] / util.cpp
blob30a3420448f26e0e09143f7d6c86a9b4aa96e3da
1 #include "util.h"
2 #include "exceptions.h"
3 #include <sstream>
5 std::string readfile(std::istream &in) {
6 std::ostringstream buf;
7 while (in.good()) {
8 char tempbuf[512];
9 in.get(tempbuf, sizeof tempbuf, '\0');
10 buf << tempbuf;
11 if (!in.good())
12 break;
13 if (in.bad())
14 throw creaturesException("IO error");
16 return buf.str();