Index: /cpp/common/util-file.cpp
===================================================================
--- /cpp/common/util-file.cpp	(revision 1152)
+++ /cpp/common/util-file.cpp	(revision 1153)
@@ -10,4 +10,7 @@
 #include <common/virtfile/virtfile.h>
 #endif
+#ifdef DEBUGGING_READWRITECOMPLETEFILE
+#include <common/dirs.h>
+#endif
 
 bool readCompleteFile(const char* filename, vector<char>& data, bool warn_on_missing_file)
@@ -15,4 +18,7 @@
 	bool ok = false;
 #ifdef USE_VIRTFILE
+#ifdef DEBUGGING_READWRITECOMPLETEFILE
+	logPrintf("","readCompleteFile",LOG_DEBUG,"virtfile: '%s'",filename);
+#endif	
 //	if (!isAbsolutePath(filename))
 	{
@@ -30,5 +36,14 @@
 #endif
 	{
+#ifdef DEBUGGING_READWRITECOMPLETEFILE
+	if (isAbsolutePath(filename))
+		logPrintf("","readCompleteFile",LOG_DEBUG,"mfopen absolute path: '%s'",filename);
+	else
+		logPrintf("","readCompleteFile",LOG_DEBUG,"mfopen: '%s' in current dir: '%s'",filename,getCurrentDirectory().c_str());
+#endif	
 		MFILE *f = mfopen(filename, FOPEN_READ_BINARY);
+#ifdef DEBUGGING_READWRITECOMPLETEFILE
+	logPrintf("", "readCompleteFile", LOG_DEBUG, "mfopen status: %s", f?"ok":"fail");
+#endif
 		if (f)
 		{
@@ -41,5 +56,8 @@
 	}
 	if (warn_on_missing_file && !ok)
-		logPrintf("stl-util", "readCompleteFile", LOG_WARN, "Couldn't open file '%s'", filename);
+		logPrintf("", "readCompleteFile", LOG_WARN, "Couldn't open file '%s'", filename);
+#ifdef DEBUGGING_READWRITECOMPLETEFILE
+	logPrintf("", "readCompleteFile", LOG_DEBUG, "bytes:%d status: %s", data.size(), ok?"ok":"fail");
+#endif
 	return ok;
 }
@@ -59,4 +77,7 @@
 {
 #ifdef USE_VIRTFILE
+#ifdef DEBUGGING_READWRITECOMPLETEFILE
+	logPrintf("","writeCompleteFile",LOG_DEBUG,"virtfile: '%s'",filename);
+#endif	
 	VirtFILE *f = Vfopen(filename, FOPEN_WRITE_BINARY);
 	bool ok = f != NULL;
@@ -68,6 +89,15 @@
 	}
 #else
+#ifdef DEBUGGING_READWRITECOMPLETEFILE
+	if (isAbsolutePath(filename))
+		logPrintf("","writeCompleteFile",LOG_DEBUG,"mfopen absolute path: '%s'",filename);
+	else
+		logPrintf("","writeCompleteFile",LOG_DEBUG,"mfopen: '%s' in current dir: '%s'",filename,getCurrentDirectory().c_str());
+#endif
 	MFILE *f = mfopen(filename, FOPEN_WRITE_BINARY);
 	bool ok = f != NULL;
+#ifdef DEBUGGING_READWRITECOMPLETEFILE
+	logPrintf("", "writeCompleteFile", LOG_DEBUG, "mfopen status: %s", ok?"ok":"fail");
+#endif
 	if (f)
 	{
@@ -78,5 +108,8 @@
 #endif
 	if (warn_on_fail && !ok)
-		logPrintf("stl-util", "writeCompleteFile", LOG_WARN, "Couldn't write file '%s'", filename);
+		logPrintf("", "writeCompleteFile", LOG_WARN, "Couldn't write file '%s'", filename);
+#ifdef DEBUGGING_READWRITECOMPLETEFILE
+	logPrintf("", "writeCompleteFile", LOG_DEBUG, "status: %s", ok?"ok":"fail");
+#endif
 	return ok;
 }
@@ -89,5 +122,9 @@
 
 // Just like fgets(), but string length is unlimited and does not store trailing \r \n
+#ifdef USE_VIRTFILE
 string readUntilEOL(VirtFILE *f)
+#else
+string readUntilEOL(FILE *f)
+#endif
 {
 	char buf[100];
@@ -95,5 +132,11 @@
 	std::string ret;
 	bool endofline;
-	while ((line = f->Vgets(buf, sizeof(buf))))
+	while ((line =
+#ifdef USE_VIRTFILE
+            f->Vgets(buf, sizeof(buf))
+#else
+            fgets(buf, sizeof(buf), f)
+#endif
+            ))
 	{
 		char* end = line + strlen(line);
Index: /cpp/common/util-file.h
===================================================================
--- /cpp/common/util-file.h	(revision 1152)
+++ /cpp/common/util-file.h	(revision 1153)
@@ -7,5 +7,9 @@
 
 #include "nonstd_stl.h"
+#ifdef USE_VIRTFILE
 #include "virtfile/virtfile.h"
+#else
+#include <stdio.h>
+#endif
 
 bool readCompleteFile(const char* filename, vector<char>& data, bool warn_on_missing_file = true);
@@ -13,5 +17,9 @@
 bool writeCompleteFile(const char* filename, const std::string& text, bool warn_on_fail = true);
 bool writeCompleteFile(const char* filename, vector<char>& data, bool warn_on_fail = true);
+#ifdef USE_VIRTFILE
 string readUntilEOL(VirtFILE *f);
+#else
+string readUntilEOL(FILE *f);
+#endif
 
 #endif
