Skip to content
Snippets Groups Projects
Commit 5db3e6c5 authored by Robert Klöfkorn's avatar Robert Klöfkorn
Browse files

Added function genFilename which generates out of a filename 'grid' and a

timestep (=0) a filename grid000000000.

[[Imported from SVN: r186]]
parent d19dfe18
No related branches found
No related tags found
No related merge requests found
......@@ -60,6 +60,41 @@ namespace Dune {
return static_cast<T*>(::malloc(size*sizeof(T)));
}
//********************************************************************
//
// generate filenames with timestep number in it
//
//********************************************************************
template <typename T>
inline const char *genFilename(T *path, T *fn, int ntime)
{
static char name[256];
char *cp;
if (path == NULL || path[0] == '\0')
{
sprintf(name, "./%s", fn);
}
else
{
const char *cp = path;
while (*cp)
cp++;
cp--;
if (*cp == '/')
sprintf(name, "%s%s", path, fn);
else
sprintf(name, "%s/%s", path, fn);
}
cp = name;
while (*cp)
cp++;
sprintf(cp, "%010d", ntime);
return( (T *) name);
}
/** @} */
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment