Index: /cpp/common/nonstd.h
===================================================================
--- /cpp/common/nonstd.h	(revision 226)
+++ /cpp/common/nonstd.h	(revision 227)
@@ -81,5 +81,5 @@
 #ifdef __ANDROID__
  #define GET_APP_HOME getAppHome()
- #define GET_APP_RESOURCES "./" //w APK trzymamy w katalogu w "assets", bo w "res" nie ma podkatalogow ani odwolywania sie po nazwach
+ #define GET_APP_RESOURCES "/resrc/" //inside APK, resources are kept in the "assets" subdirectory (in the "res" subdirectory there is no support for subdirectories nor accessing files by name). The prefix /resrc/ is just an indication that lets mfile easily discriminate between HOME (r/w) and RESOURCES (r) locations
 #endif
 
Index: /cpp/common/nonstd_math.cpp
===================================================================
--- /cpp/common/nonstd_math.cpp	(revision 226)
+++ /cpp/common/nonstd_math.cpp	(revision 227)
@@ -24,5 +24,5 @@
 
 
-#if defined LINUX || defined TIZEN || defined __ANDROID__
+#if defined LINUX || defined TIZEN || defined __ANDROID__ || defined IPHONE
 
 #include <fenv.h>
@@ -44,23 +44,4 @@
 #endif
 
-
-#ifdef IPHONE
-
-#include <fenv.h>
-
-void fpExceptInit()
-{}
-
-void fpExceptEnable()
-{
-feclearexcept(FE_DIVBYZERO | FE_OVERFLOW);
-//feenableexcept(FE_DIVBYZERO | FE_OVERFLOW);
-}
-
-void fpExceptDisable()
-{
-//fedisableexcept(FE_DIVBYZERO | FE_OVERFLOW);
-}
-#endif
 
 
Index: /cpp/common/nonstd_stdio.cpp
===================================================================
--- /cpp/common/nonstd_stdio.cpp	(revision 226)
+++ /cpp/common/nonstd_stdio.cpp	(revision 227)
@@ -139,18 +139,26 @@
 
 #ifdef __ANDROID__
-//#include "framsg.h"
+#include "framsg.h"
 #include "nonstd.h"
+#include "nonstd_stl.h"
 MFILE *mfopen(const char *path, const char *mode)
 {
-	NvFile *rfile=NULL; //umie tylko czytac
+	string respath=GET_APP_RESOURCES; //the macro can be char* or std::string, we don't know (nonstd.h, INITIAL_DIR_IS_RES, cwd.cpp) so we convert it to std::string
+	//printFM("Opening '%s', mode='%s'",path,mode);
+	//printFM("GET_APP_RESOURCES='%s'",respath.c_str());
+	NvFile *rfile=NULL; //can only read
 	FILE *rwfile=NULL;
-	if (strstr(path,GET_APP_RESOURCES)==path) //otwieramy resource! wiec uzywamy czytania z assets
-	{
-		if (path[0]=='.' && path[1]=='/') path+=2; //nie rozpoznaje sciezek "./costam", a w sailorze zrobiles tak ze nie moze byc pusty path bo to jest znacznik ze jest niezainicjowany, dlatego uzywasz "./" i musimy je tu obcinac
-		rfile=NvFOpen(path); //"mode" not supported! umie tylko czytac
+	if (strstr(path,respath.c_str())==path) //opening resource! so we use a dedicated way to read from assets
+	{
+		path+=respath.length(); //strip the prefix, we need a relative path in assets
+		if (strstr(mode,"w"))
+			printFM("Warning: attempt to open a read-only resource '%s' in writable mode '%s'",path,mode);
+		rfile=NvFOpen(path); //"mode" not supported! can only read
+		//printFM("Opened RES file as %p",rfile);
 		if (rfile==NULL) return NULL;
-	} else //"normalny" dostep (do HOME)
+	} else //a "normal" access (HOME)
 	{
 		rwfile=fopen(path,mode);
+		//printFM("Opened HOME file as %p",rwfile);
 		if (rwfile==NULL) return NULL;
 	}
@@ -174,5 +182,5 @@
 {
 	if (f->rfile)
-		return size==0?0:NvFRead(ptr, size, count, f->rfile)/size; //blad nvidii w interpretacji zwracanej wartosci - zwraca liczbe bajtow zamiast liczbe porcji
+		return NvFRead(ptr, size, count, f->rfile); //nvidia introduced my corrections in SDK v10.14, so a fix is no longer needed here
 	else
 		return fread(ptr, size, count, f->rwfile);
@@ -182,5 +190,5 @@
 {
 	if (f->rfile)
-		return 0; //write not supported funkcjami nvidii
+		return 0; //write not supported in assets using nvidia functions
 	else
 		return fwrite(ptr, size, count, f->rwfile);
@@ -197,5 +205,11 @@
 {
 	if (f->rfile)
-		return NvFGets(str, num, f->rfile);
+	{
+		char *ret=NvFGets(str, num, f->rfile);
+		//fixing nvidia inconsistency... their function never returns NULL (fix submitted)
+		if (ret!=NULL && *ret==0 && num>0) //nothing has been read, must have been eof
+			return NULL;
+		return ret;
+	}
 	else
 		return fgets(str,num,f->rwfile);
@@ -213,5 +227,5 @@
 {
 	if (f->rfile)
-		return NvFSeek(f->rfile, position, type)==-1; // off_t AAsset_seek(AAsset* asset, off_t offset, int whence): Returns the new position on success, or (off_t) -1 on error.
+		return NvFSeek(f->rfile, position, type); //nvidia introduced my corrections in SDK v10.14, so a fix is no longer needed here
 	else
 		return fseek(f->rwfile, position, type);
Index: /cpp/common/nonstd_stdio.h
===================================================================
--- /cpp/common/nonstd_stdio.h	(revision 226)
+++ /cpp/common/nonstd_stdio.h	(revision 227)
@@ -45,6 +45,6 @@
 #include <nv_file/nv_file.h>
  struct rwFILE //jedno z dwoch pol jest zainicjowane w zaleznosci od tego gdzie jest plik
- {
-	NvFile *rfile; //umie tylko czytac
+ { //nvidia uses a similar trick in nv_file.h (STD_FILE and APK_FILE), maybe doing a similar thing here is redundant? but their trick uses some trial-and-error code (see NvFOpen())
+	NvFile *rfile; //can only read
 	FILE *rwfile;
 	rwFILE() {rfile=rwfile=NULL;}
Index: /cpp/frams/virtfile/stdiofile.cpp
===================================================================
--- /cpp/frams/virtfile/stdiofile.cpp	(revision 226)
+++ /cpp/frams/virtfile/stdiofile.cpp	(revision 227)
@@ -35,4 +35,5 @@
 void StdioFILE::setStdio()
 {
+#ifndef NO_STD_IN_OUT_ERR
 	static StdioFILEDontClose si(stdin);
 	static StdioFILEDontClose so(stdout);
@@ -41,4 +42,5 @@
 	setVstdout(&so);
 	setVstderr(&se);
+#endif
 }
 
Index: /cpp/frams/virtfile/stdiofile.h
===================================================================
--- /cpp/frams/virtfile/stdiofile.h	(revision 226)
+++ /cpp/frams/virtfile/stdiofile.h	(revision 227)
@@ -43,5 +43,5 @@
 const char* VgetPath() {return path;}
 
-~StdioFILE() {if (file) fclose(file);}
+~StdioFILE() {if (file) mfclose(file);}
 };
 #else
