default to read mode in filestreams

master
Daniel Kolesa 2016-03-26 15:19:00 +00:00
parent 54789177e2
commit ce42683c99
3 changed files with 4 additions and 4 deletions

View File

@ -12,7 +12,7 @@ int main() {
copy(iter({ 0xABCD1214, 0xBADC3264, 0xDEADBEEF, 0xBEEFDEAD }), wtest.iter<Uint32>());
wtest.close();
FileStream rtest("test.bin", StreamMode::read);
FileStream rtest("test.bin");
writefln("stream size: %d", rtest.size());
for (Uint32 x: map(rtest.iter<Uint32>(), FromBigEndian<Uint32>()))

View File

@ -19,7 +19,7 @@ int main() {
copy(smpl.iter(), wtest.iter());
wtest.close();
FileStream test("test.txt", StreamMode::read);
FileStream test("test.txt");
writeln("## WHOLE FILE READ ##\n");

View File

@ -34,7 +34,7 @@ struct FileStream: Stream {
s.p_owned = false;
}
FileStream(ConstCharRange path, StreamMode mode): p_f() {
FileStream(ConstCharRange path, StreamMode mode = StreamMode::read): p_f() {
open(path, mode);
}
@ -49,7 +49,7 @@ struct FileStream: Stream {
return *this;
}
bool open(ConstCharRange path, StreamMode mode) {
bool open(ConstCharRange path, StreamMode mode = StreamMode::read) {
if (p_f || (path.size() > FILENAME_MAX)) return false;
char buf[FILENAME_MAX + 1];
memcpy(buf, &path[0], path.size());