mirror of
https://github.com/zenorogue/hyperrogue.git
synced 2025-01-23 15:36:59 +00:00
utils:: read_file_as_string
This commit is contained in:
parent
48702739fd
commit
f101ddb7fd
15
util.cpp
15
util.cpp
@ -805,6 +805,21 @@ EX void open_wiki(const char *title) {
|
||||
open_url(url);
|
||||
}
|
||||
|
||||
EX string read_file_as_string(string fname) {
|
||||
string buf;
|
||||
#if ISANDROID || ISIOS
|
||||
buf = get_asset(fname);
|
||||
#else
|
||||
FILE *f = fopen(fname.c_str(), "rb");
|
||||
if(!f) f = fopen((rsrcdir + fname).c_str(), "rb");
|
||||
buf.resize(1000000);
|
||||
int qty = fread(&buf[0], 1, 1000000, f);
|
||||
buf.resize(qty);
|
||||
fclose(f);
|
||||
#endif
|
||||
return buf;
|
||||
}
|
||||
|
||||
EX void floyd_warshall(vector<vector<char>>& v) {
|
||||
int N = isize(v);
|
||||
for(int k=0; k<N; k++)
|
||||
|
Loading…
Reference in New Issue
Block a user