Index: cpp/common/framsg.cpp
===================================================================
--- cpp/common/framsg.cpp	(revision 179)
+++ cpp/common/framsg.cpp	(revision 180)
@@ -5,4 +5,5 @@
 #include "framsg.h"
 #include <common/nonstd_stdio.h>
+#include "stl-util.h"
 #include "Convert.h"
 
@@ -11,7 +12,6 @@
 void FMprintf_va(const char *o,const char *m,int w,const char *bl,va_list va)
 {
-	char buf[10000];
-	vsnprintf(buf,10000,bl,va);
-	FramMessage(o,m,buf,w);
+	string buf=ssprintf_va(bl,va);
+	FramMessage(o,m,buf.c_str(),w);
 }
 
Index: cpp/common/stl-util.cpp
===================================================================
--- cpp/common/stl-util.cpp	(revision 180)
+++ cpp/common/stl-util.cpp	(revision 180)
@@ -0,0 +1,101 @@
+#include "stl-util.h"
+#include <stdarg.h>
+#include <stdlib.h>
+#include "nonstd_stdio.h"
+#include "nonstd.h"
+#include "framsg.h"
+
+string ssprintf_va(const char* format, va_list ap)
+{
+	string s; //clang crashed when this declaration was in s=buf - dreadful GOTO? - i doubt it... goto did not skip over any variable declarations in this case
+	long size=1000;
+	char* buf;
+retry:
+	buf=(char*)malloc(size);
+	if (vsnprintf(buf,size,format,ap)>=size) {free(buf); size*=4; goto retry;}
+	s=buf;
+	free(buf);
+	return s;
+}
+
+string ssprintf(const char* format, ...)
+{
+	va_list ap;
+	va_start(ap, format);
+	string ret=ssprintf_va(format,ap); //is it too wasteful? copying the string again... unless the compiler can handle it better
+	va_end(ap);
+	return ret;
+}
+
+bool readCompleteFile(const char* filename, vector<char>& data, bool warn_on_missing_file)
+{
+	MFILE *f=mfopen(filename,FOPEN_READ_BINARY);
+	bool ok=f!=NULL;
+	if (f)
+	{
+		mfseek(f,0,SEEK_END);
+		long size=mftell(f);
+		mfseek(f,0,SEEK_SET);
+		data.resize(size);
+		int przeczytane=mfread(&data[0],size,1,f);
+		mfclose(f);
+		ok&=przeczytane==1;
+	}
+	if (warn_on_missing_file && !ok)
+		FMprintf("stl-util","readCompleteFile",FMLV_WARN,"Couldn't open file '%s'",filename);
+	return ok;
+}
+
+bool readCompleteFile(const char* filename, string& out, bool warn_on_missing_file)
+{
+	std::vector<char> data;
+	if (readCompleteFile(filename,data,warn_on_missing_file))
+	{
+		out=string(&data[0],data.size());
+		return true;
+	}
+	return false;
+}
+
+bool writeCompleteFile(const char* filename, const string& text, bool warn_on_fail)
+{
+	MFILE *f=mfopen(filename,FOPEN_WRITE_BINARY);
+	bool ok=f!=NULL;
+	if (f)
+	{
+		int zapisane=mfwrite(text.c_str(),text.length(),1,f);
+		mfclose(f);
+		ok&=zapisane==1;
+	}
+	if (warn_on_fail && !ok)
+		FMprintf("stl-util","writeCompleteFile",FMLV_WARN,"couldn't write file '%s'",filename);
+	return ok;
+}
+
+bool writeCompleteFile(const char* filename, vector<char>& data, bool warn_on_fail)
+{
+	string s(&data[0],data.size());
+	return writeCompleteFile(filename, s, warn_on_fail);
+}
+
+
+
+std::string stripExt(const std::string& filename)
+{
+	int dot=filename.rfind('.');
+	if (dot==std::string::npos) return filename;
+	int sep=filename.rfind(PATH_SEPARATOR_CHAR);
+	if ((sep==std::string::npos)||(sep<dot))
+		return filename.substr(0,dot);
+	return filename;
+}
+
+std::string getFileExt(const std::string& filename)
+{
+	int dot=filename.rfind('.');
+	if (dot==std::string::npos) return string("");
+	int sep=filename.rfind(PATH_SEPARATOR_CHAR);
+	if ((sep==std::string::npos)||(sep<dot))
+		return filename.substr(dot);
+	return string("");
+}
Index: cpp/common/stl-util.h
===================================================================
--- cpp/common/stl-util.h	(revision 179)
+++ cpp/common/stl-util.h	(revision 180)
@@ -7,4 +7,5 @@
 
 #include "nonstd_stl.h"
+#include <stdarg.h>
 
 template<typename T, std::size_t N> void push_back(vector<T>& v, T(&d)[N])
@@ -37,6 +38,8 @@
 
 string ssprintf(const char* format, ...);
+string ssprintf_va(const char* format, va_list ap);
 
 string stripExt(const string& filename); // strip extension from filename
+string getFileExt(const string& filename); // get extension (starting with ".") from filename
 
 bool readCompleteFile(const char* filename, vector<char>& data, bool warn_on_missing_file=true);
Index: cpp/frams/Makefile-GDK-files
===================================================================
--- cpp/frams/Makefile-GDK-files	(revision 179)
+++ cpp/frams/Makefile-GDK-files	(revision 180)
@@ -4,10 +4,10 @@
 ALL_DIRS={common,frams,frams/canvas,frams/config,frams/errmgr,frams/genetics,frams/genetics/f0,frams/genetics/f1,frams/genetics/f2,frams/genetics/f3,frams/genetics/f4,frams/genetics/f5,frams/genetics/f6,frams/genetics/f7,frams/genetics/f8,frams/genetics/f9,frams/genetics/fF,frams/model,frams/neuro,frams/neuro/impl,frams/param,frams/test,frams/util,frams/vm/classes,frams/virtfile,frams/_demos}
 
-GENOCONV_GDK_OBJS=frams/genetics/defgenoconv.o frams/genetics/f1/conv_f1.o frams/genetics/f9/conv_f9.o frams/genetics/fF/conv_fF.o frams/genetics/fF/fF_genotype.o frams/genetics/fF/fF_chamber3d.o 
+GENOCONV_GDK_OBJS=frams/genetics/defgenoconv.o frams/genetics/f1/conv_f1.o frams/genetics/f9/conv_f9.o frams/genetics/fF/conv_fF.o frams/genetics/fF/fF_genotype.o frams/genetics/fF/fF_chamber3d.o
 
 GENMAN_COMMON_OBJS=frams/genetics/genman.o frams/param/mutableparam.o frams/param/mutparamlist.o frams/neuro/geneticneuroparam.o frams/neuro/neurolibparam.o frams/vm/classes/genoobj.o frams/model/autoname.o
 GENMAN_GDK_OBJS=$(GENMAN_COMMON_OBJS) frams/genetics/f9/oper_f9.o frams/genetics/fF/oper_fF.o
 
-GDK_OBJS=frams/util/list.o frams/util/advlist.o frams/param/param.o frams/util/sstring.o frams/util/sstringutils.o frams/util/3d.o frams/vm/classes/3dobject.o frams/model/model.o frams/model/modelparts.o frams/neuro/neurolibrary.o frams/genetics/geno.o frams/genetics/genoconv.o frams/util/extvalue.o frams/vm/classes/collectionobj.o frams/util/hashtable.o common/framsg.o frams/util/callbacks.o frams/param/syntparam.o frams/util/multirange.o frams/util/multimap.o frams/param/paramtabobj.o frams/errmgr/errmanager.o frams/param/paramobj.o frams/genetics/oper_fx.o common/nonstd_math.o frams/errmgr/stderrors.o common/Convert.o frams/util/rndutil.o
+GDK_OBJS=frams/util/list.o frams/util/advlist.o frams/param/param.o frams/util/sstring.o frams/util/sstringutils.o frams/util/3d.o frams/vm/classes/3dobject.o frams/model/model.o frams/model/modelparts.o frams/neuro/neurolibrary.o frams/genetics/geno.o frams/genetics/genoconv.o frams/util/extvalue.o frams/vm/classes/collectionobj.o frams/util/hashtable.o common/framsg.o common/stl-util.o frams/util/callbacks.o frams/param/syntparam.o frams/util/multirange.o frams/util/multimap.o frams/param/paramtabobj.o frams/errmgr/errmanager.o frams/param/paramobj.o frams/genetics/oper_fx.o common/nonstd_math.o frams/errmgr/stderrors.o common/Convert.o frams/util/rndutil.o
 
 
Index: cpp/frams/errmgr/errmanager.cpp
===================================================================
--- cpp/frams/errmgr/errmanager.cpp	(revision 179)
+++ cpp/frams/errmgr/errmanager.cpp	(revision 180)
@@ -4,5 +4,5 @@
 
 #include "errmanager.h"
-
+#include <common/stl-util.h>
 
 void FramMessage(const char *o,const char *m,const char *bl,int w)
@@ -65,10 +65,10 @@
 {
 if (!isEnabled()) return;
-char buf[10000];
+string buf;
 va_list argptr;
 va_start(argptr,bl);
-vsnprintf(buf,10000,bl,argptr);
+buf=ssprintf_va(bl,argptr);
 va_end(argptr);
-send(o,m,buf,w);
+send(o,m,buf.c_str(),w);
 }
 
Index: cpp/frams/genetics/genoconv.cpp
===================================================================
--- cpp/frams/genetics/genoconv.cpp	(revision 179)
+++ cpp/frams/genetics/genoconv.cpp	(revision 180)
@@ -15,4 +15,5 @@
 #include "genoconv.h"
 #include <frams/util/multimap.h>
+#include <common/stl-util.h>
 
 ///////////////////////////////////////////////////////////////////////////
@@ -189,7 +190,6 @@
 		if (!tmp.len())
 		{
-			char t[100];
-			sprintf(t, "f%c->f%c conversion failed (%s)", gk->in_format, gk->out_format, gk->name);
-			return Geno(0, 0, 0, t);
+			string t=ssprintf("f%c->f%c conversion failed (%s)", gk->in_format, gk->out_format, gk->name);
+			return Geno(0, 0, 0, t.c_str());
 		}
 		if (mapavail)
