]> git.tdb.fi Git - libs/core.git/blobdiff - source/io/seek.cpp
Move files to prepare for assimilation into core
[libs/core.git] / source / io / seek.cpp
diff --git a/source/io/seek.cpp b/source/io/seek.cpp
new file mode 100644 (file)
index 0000000..b10c5a0
--- /dev/null
@@ -0,0 +1,32 @@
+#ifdef WIN32
+#include <windows.h>
+#endif
+#include "except.h"
+#include "seek.h"
+
+namespace Msp {
+namespace IO {
+
+int sys_seek_type(SeekType st)
+{
+#ifdef WIN32
+       if(st==S_BEG)
+               return FILE_BEGIN;
+       else if(st==S_CUR)
+               return FILE_CURRENT;
+       else if(st==S_END)
+               return FILE_END;
+#else
+       if(st==S_BEG)
+               return SEEK_SET;
+       else if(st==S_CUR)
+               return SEEK_CUR;
+       else if(st==S_END)
+               return SEEK_END;
+#endif
+
+       throw InvalidParameterValue("Invalid seek type");
+}
+
+} // namespace IO
+} // namespace Msp