MCPcopy Create free account
hub / github.com/computationalpathologygroup/ASAP / getTempFile

Function getTempFile

core/filetools.cpp:935–952  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

933 }
934
935 void getTempFile(std::string &filename, const std::string &prefix)
936 {
937#ifdef WIN32
938 char buffer[MAX_PATH];
939 char fnbuffer[MAX_PATH];
940 GetTempPath(MAX_PATH, buffer);
941 GetTempFileName(buffer, prefix.c_str(), 0, fnbuffer);
942 filename = fnbuffer;
943#else
944 // char* buffer = std::getenv("TEMP");
945 char buffer[MAX_PATH];
946 sprintf(buffer, "%sXXXXXX", prefix.c_str());
947 // WARNING: UGLY. Better this function should return a file handler
948 close(mkstemp(buffer));
949 filename = std::string(buffer);
950#endif
951
952 }
953
954 void getTempDir(std::string &dirname)
955 {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected