src/sgp/Video.cc
/* Create a file for a screenshot, which is guaranteed not to exist yet. */
Create a file for a screenshot, which is guaranteed not to exist yet.
Create a file for a screenshot which is guaranteed not to exist yet .
static FILE* CreateScreenshotFile(void)
{
	const std::string exec_dir = GCM->getScreenshotFolder();
	do
	{
		char filename[2048];
		sprintf(filename, "%s/SCREEN%03d.TGA", exec_dir.c_str(), guiPrintFrameBufferIndex++);
#ifndef _WIN32
#	define O_BINARY 0
#endif
		int const fd = open3(filename, O_WRONLY | O_CREAT | O_EXCL | O_BINARY, 0644);
		if (fd >= 0)
		{
			FILE* const f = fdopen(fd, "wb");
			if (f == NULL) close(fd);
			return f;
		}
	}
	while (errno == EEXIST);
	return NULL;
}
static FILE * CreateScreenshotFile ( void ) { const std :: string exec_dir = GCM -> getScreenshotFolder ( ) ; do { char filename [ 2048 ] ; sprintf ( filename , " " , exec_dir . c_str ( ) , guiPrintFrameBufferIndex ++ ) ; #ifndef _WIN32 #	define O_BINARY  0 #endif int const fd = open3 ( filename , O_WRONLY | O_CREAT | O_EXCL | O_BINARY , 0644 ) ; if ( fd >= 0 ) { FILE * const f = fdopen ( fd , " " ) ; if ( f == NULL ) close ( fd ) ; return f ; } } while ( errno == EEXIST ) ; return NULL ; }
Create a file for a screenshot, which is guaranteed not to exist yet.
Create a file for a screenshot which is guaranteed not to exist yet .