//	Zinc Application Framework - Z_STDIO.CPP
//	COPYRIGHT (C) 1990-1999.  All Rights Reserved.
//	Zinc Software Incorporated.  Pleasant Grove, Utah  USA

#include <z_stdio.hpp>
#include <z_cset.hpp>

#if defined(ZAF_UNICODE)
#	include "u_stdio.cpp"
#elif defined(ZAF_ISO8859_1)
#include <z_string.hpp>

FILE *ZafFOpen(const ZafIChar *path, const ZafIChar *mode)
{
	// Convert the name to an OS string.
	char mappedPath[ZAF_MAXPATHLEN], mappedMode[ZAF_MAXPATHLEN];
#if defined(USE_ZAF_CODE_SET_DATA)
	zafCodeSet->ConvertToOSString(path, mappedPath, false);
	zafCodeSet->ConvertToOSString(mode, mappedMode, false);
#else
	strcpy(mappedPath, path);
	strcpy(mappedMode, mode);
#endif

#undef fopen
	// Open the file.
	return (OSfopen(mappedPath, mappedMode));
}

ZafIChar *ZafTmpNam(ZafIChar *string)
{
	static char mappedString[L_tmpnam];
	static ZafIChar newString[L_tmpnam];
	if (!string)
		string = newString;
#if defined(ZAF_PSOS)
#	undef tmpname
#else
#	undef tmpnam
#endif
	OStmpnam(mappedString);
#if defined(USE_ZAF_CODE_SET_DATA)
	zafCodeSet->ConvertToZafString(mappedString, string, false);
#else
	strcpy(string, mappedString);
#endif
	return string;
}
#else
	// We use the compiler's library for OEM characters
#endif
