#include "VOS_API/DX_VOS_Stdio.h"
#include "VOS_API/DX_VOS_Mem.h"
#include <stdio.h>

IMPORT_C void  DX_VOS_PrintString(const DxChar *aStr)
{
	if (aStr != DX_NULL)
		printf("%s",aStr);
}

IMPORT_C DxInt_t DX_VOS_GetCh(void)
{
    return getchar();
}

//FILE originalStdOut;
DxBool_t redirected = DX_FALSE;
DxStatus DX_VOS_RedirectStdoutToFile(const DxChar* fileName)
{
    if (redirected == DX_FALSE)
    {
        //originalStdOut = *stdout;
        redirected = DX_TRUE;
        //DX_VOS_MemSet(stdout,0,sizeof(FILE));
    }
    /*
    if (freopen(fileName, "wb", stdout) == 0)
        RETURN_CONST_STATUS(DX_VOS_FILE_ERROR);
	*/
	DX_RETURN(DX_SUCCESS);
}

void DX_VOS_CancelStdOutRedirection(void)
{
    if (redirected)
    {
        //fclose(stdout);
        //*stdout = originalStdOut;
        redirected = DX_FALSE;
    }
}

DxStatus DX_VOS_UpdateStdout(void)
{
    //RETURN_VAR_STATUS(DX_VOS_FFlush((DxVosFile)stdout));
	DX_RETURN(DX_SUCCESS);
}
