Index: /cpp/common/stl-util.cpp
===================================================================
--- /cpp/common/stl-util.cpp	(revision 522)
+++ /cpp/common/stl-util.cpp	(revision 523)
@@ -77,5 +77,5 @@
 	bool ok = false;
 #ifdef USE_VIRTFILE
-	if (!isAbsolutePath(filename))
+//	if (!isAbsolutePath(filename))
 	{
 		VirtFILE *f=Vfopen(filename,FOPEN_READ_BINARY);
@@ -89,5 +89,5 @@
 		}
 	}
-	else
+//	else
 #endif
 	{
@@ -120,4 +120,14 @@
 bool writeCompleteFile(const char* filename, const string& text, bool warn_on_fail)
 {
+#ifdef USE_VIRTFILE
+	VirtFILE *f = Vfopen(filename, FOPEN_WRITE_BINARY);
+	bool ok = f != NULL;
+	if (f)
+	{
+		int zapisane = f->Vwrite(text.c_str(), text.length(), 1);
+		delete f;
+		ok &= zapisane == 1;
+	}
+#else
 	MFILE *f = mfopen(filename, FOPEN_WRITE_BINARY);
 	bool ok = f != NULL;
@@ -128,6 +138,7 @@
 		ok &= zapisane == 1;
 	}
+#endif
 	if (warn_on_fail && !ok)
-		logPrintf("stl-util", "writeCompleteFile", LOG_WARN, "couldn't write file '%s'", filename);
+		logPrintf("stl-util", "writeCompleteFile", LOG_WARN, "Couldn't write file '%s'", filename);
 	return ok;
 }
Index: /cpp/common/virtfile/virtfile.h
===================================================================
--- /cpp/common/virtfile/virtfile.h	(revision 522)
+++ /cpp/common/virtfile/virtfile.h	(revision 523)
@@ -136,7 +136,9 @@
 DLLEXP bool Vdirexists(const char* path, bool is_writable);
 
+#ifdef VIRTFILE_OVERLOADING
+//may be needed for redefine... or if someone simply prefers overloading ;-)
+
 DLLEXP int fread(void *ptr, size_t size, size_t nmemb, VirtFILE* f);
 DLLEXP int fwrite(const void *ptr, size_t size, size_t nmemb, VirtFILE* f);
-
 
 //since we want our own feof(VirtFILE*) function and some systems unfortunately define feof as a macro, we need to #undef it. Same as in virtfile.cpp
@@ -174,4 +176,5 @@
 DLLEXP int closedir(VirtDIR* d);
 
+#endif //VIRTFILE_OVERLOADING
+
 #endif
-
Index: /cpp/frams/param/multiparamload.cpp
===================================================================
--- /cpp/frams/param/multiparamload.cpp	(revision 522)
+++ /cpp/frams/param/multiparamload.cpp	(revision 523)
@@ -66,5 +66,5 @@
 if (file && ownfile)
 	{
-	fclose(file);
+	delete file;
 	file=0;
 	}
@@ -258,5 +258,5 @@
 {
 VirtFILE *f;
-while(f=popstack()) fclose(f);
+while(f=popstack()) delete f;
 }
 
@@ -264,5 +264,5 @@
 {
 if (!filestack.size()) return false;
-if (file) fclose(file);
+if (file) delete file;
 file=popstack();
 return true;
Index: /cpp/frams/param/param.cpp
===================================================================
--- /cpp/frams/param/param.cpp	(revision 522)
+++ /cpp/frams/param/param.cpp	(revision 523)
@@ -25,5 +25,5 @@
 	int z;
 	char last_char = 0;
-	while ((z = fgetc(f)) != EOF)
+	while ((z = f->Vgetc()) != EOF)
 	{
 		if (z == '~')
@@ -267,6 +267,6 @@
 	if ((altname == NULL) || (altname[0] != 0))
 	{
-		err |= (fputs(altname ? altname : getName(), f) == EOF);
-		err |= (fputs(":\n", f) == EOF);
+		err |= (f->Vputs(altname ? altname : getName()) == EOF);
+		err |= (f->Vputs(":\n") == EOF);
 		withname = true;
 	}
@@ -274,5 +274,5 @@
 		err |= saveprop(f, i, p, force);
 	if (withname)
-		err |= (fputs("\n", f) == EOF);
+		err |= (f->Vputs("\n") == EOF);
 	return err;
 }
@@ -290,5 +290,5 @@
 	int err = 0, cr;
 
-	err |= (fputs(p, f) == EOF); fputc(':', f);
+	err |= (f->Vputs(p) == EOF); f->Vputc(':');
 	cr = 0;
 	if ((*typ == 'x') || (*typ == 'o'))
@@ -304,7 +304,7 @@
 	if (ws.len() > 50) cr = 1;
 	else for (t = w; *t; t++) if ((*t == 10) || (*t == 13)) { cr = 1; break; }
-	if (cr) fputs("~\n", f);
-	err |= (fputs(w, f) == EOF);
-	err |= (fputs(cr ? "~\n" : "\n", f) == EOF);
+	if (cr) f->Vputs("~\n");
+	err |= (f->Vputs(w) == EOF);
+	err |= (f->Vputs(cr ? "~\n" : "\n") == EOF);
 	return err;
 }
@@ -464,5 +464,5 @@
 						}
 					removeCR(s);
-					int ch; while ((ch = fgetc(f)) != EOF) if (ch == '\n') break;
+					int ch; while ((ch = f->Vgetc()) != EOF) if (ch == '\n') break;
 					unquoteTilde(s);
 					if (linenum && (flags(i)&PARAM_LINECOMMENT))
@@ -501,5 +501,5 @@
 				(*linenum) += lfcount;
 			}
-			int ch; while ((ch = fgetc(f)) != EOF) if (ch == '\n') break;
+			int ch; while ((ch = f->Vgetc()) != EOF) if (ch == '\n') break;
 		}
 	}
Index: /cpp/frams/util/sstringutils.cpp
===================================================================
--- /cpp/frams/util/sstringutils.cpp	(revision 522)
+++ /cpp/frams/util/sstringutils.cpp	(revision 523)
@@ -16,5 +16,5 @@
 		loadSString(f, s);
 		ret = 1;
-		fclose(f);
+		delete f;
 	}
 	else if (framsgmodule)
@@ -29,5 +29,5 @@
 	while (!f->Veof())
 	{
-		len = fread(buf, 1, sizeof(buf), f);
+		len = f->Vread(buf, 1, sizeof(buf));
 		s.append(buf, len);
 	}
@@ -44,5 +44,5 @@
 	while (!eolfound)
 	{
-		char *r = fgets(buf, sizeof(buf), f);
+		char *r = f->Vgets(buf, sizeof(buf));
 		if (r == NULL) break;
 		ret = true;
Index: /cpp/frams/vm/framscript.y
===================================================================
--- /cpp/frams/vm/framscript.y	(revision 522)
+++ /cpp/frams/vm/framscript.y	(revision 523)
@@ -149,6 +149,6 @@
 
 asmlines: /* empty */
-        | ASMLINE            {fputs(str($1),trctx.out);fputc('\n',trctx.out);}
-        | asmlines ASMLINE   {fputs(str($2),trctx.out);fputc('\n',trctx.out);}
+        | ASMLINE            {trctx.out->Vputs(str($1));trctx.out->Vputc('\n');}
+        | asmlines ASMLINE   {trctx.out->Vputs(str($2));trctx.out->Vputc('\n');}
 ;
 
