repo.or.cz
/
openc2e.git
/
blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
log
|
graphiclog1
|
graphiclog2
|
commit
|
commitdiff
|
tree
|
refs
|
edit
|
fork
blame
|
history
|
raw
|
HEAD
main.cpp/physics.h: add some (somewhat icky) compile fixes for OS X
[openc2e.git]
/
util.cpp
blob
30a3420448f26e0e09143f7d6c86a9b4aa96e3da
1
#include
"util.h"
2
#include
"exceptions.h"
3
#include <sstream>
4
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"
);
15
}
16
return
buf
.
str
();
17
}