lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


I would beg for the following small addition to liolib.c
(
+#ifdef _WIN32
+static int f_setmode (lua_State *L) {
+  int res;
+  const char* mode = luaL_optstring(L,2,"b");
+  int bmode = *mode == 'b' ? _O_BINARY  : _O_TEXT ;
+  res =  _setmode(_fileno(tofile(L)),bmode) != -1;
+
+  return pushresult(L, res, NULL);
+}
+#endif

+#ifdef _WIN32
+  {"setmode", f_setmode},
+#endif

David B