示例#1
0
static PyObject *
winutil_prepare_for_restart(PyObject *self, PyObject *args) {
    FILE *f1 = NULL, *f2 = NULL;
    if (stdout != NULL) fclose(stdout);
    if (stderr != NULL) fclose(stderr);
    _wfreopen_s(&f1, L"NUL", L"a+t", stdout);
    _wfreopen_s(&f2, L"NUL", L"a+t", stderr);
    Py_RETURN_NONE;
}
示例#2
0
void SystemClass::CreateConsole()
{
	AllocConsole();  // Create Console Window

	FILE *stream;

	wstring ConsoleName = L"Information Console";

	_wfreopen_s(&stream, L"CONIN$", L"rb", stdin);   // reopen stdin handle as console window input

	_wfreopen_s(&stream, L"CONOUT$", L"wb", stdout);  // reopen stout handle as console window output

	_wfreopen_s(&stream, L"CONOUT$", L"wb", stderr); // reopen stderr handle as console window output

	SetConsoleTitle(ConsoleName.c_str());
	
}
示例#3
0
文件: Logger.cpp 项目: malensek/3RVX
void Logger::Start() {
#ifdef ENABLE_3RVX_LOGTOFILE
    /* Disable buffering */
    setvbuf(stdout, NULL, _IONBF, 0);
    setvbuf(stderr, NULL, _IONBF, 0);

    FILE *out, *err;
    _wfreopen_s(&out, L"3RVX_Log.txt", L"w", stdout);
    _wfreopen_s(&err, L"3RVX_Log.txt", L"w", stderr);
#else
#if ENABLE_3RVX_LOG != 0
    AllocConsole();
    FILE *in, *out, *err;
    freopen_s(&in, "CONIN$", "r", stdin);
    freopen_s(&out, "CONOUT$", "w", stdout);
    freopen_s(&err, "CONOUT$", "w", stderr);
#endif
#endif
}
示例#4
0
void IPU::create() {

    _wfreopen_s(
        &m_hLogFile,
        L"stdout.txt" ,
        L"w+t" ,
        stdout);

    m_logThreadExitSign=false;
    _beginthread(&updateLog,0,NULL);

    out("create");

    m_L=lua_open();
    if(m_L==NULL) {
        out("lua_open failed");
    } else {
        out("lua_open succeeded");
    }

    loadModules();

    if(luaL_dofile(m_L,"main.lua")!=0) {
        out("An error detected when loading main.lua");
        out("////////////////Error detail////////////////");
        out(lua_tostring(m_L,-1));
        out("////////////////////////////////////////////");
    } else {
        out("lua ok");
        m_isLuaOK=true;
    }

    m_hAccelTable
        = LoadAccelerators(
            GetModuleHandle(NULL),
            MAKEINTRESOURCE(IDC_IPU));
	
    createWindow();

#ifdef _x64
    out("starting x86 ime hook layer");
    PROCESS_INFORMATION pi;
    STARTUPINFO si;
    ZeroMemory(&si,sizeof(si));
    si.cb=sizeof(si);

    CreateProcess(_T("zs_x86layer.exe"),NULL,NULL,NULL,FALSE,NORMAL_PRIORITY_CLASS,NULL,NULL,&si,&pi);

#endif
}
示例#5
0
文件: file.c 项目: scorpion007/ruby
int
rb_freopen(VALUE fname, const char *mode, FILE *file)
{
    WCHAR *wname, wmode[4];
    long len;
    int e = 0, n = MultiByteToWideChar(CP_ACP, 0, mode, -1, NULL, 0);
    if (n > numberof(wmode)) return EINVAL;
    MultiByteToWideChar(CP_ACP, 0, mode, -1, wmode, numberof(wmode));
    wname = rb_w32_mbstr_to_wstr(CP_UTF8, RSTRING_PTR(fname),
                                 rb_long2int(RSTRING_LEN(fname)) + 1, &len);
    wname[len - 1] = L'\0';
    RB_GC_GUARD(fname);
#if RUBY_MSVCRT_VERSION < 80 && !defined(HAVE__WFREOPEN_S)
    e = _wfreopen(wname, wmode, file) ? 0 : errno;
#else
    {
        FILE *newfp = 0;
        e = _wfreopen_s(&newfp, wname, wmode, file);
    }
#endif
    free(wname);
    return e;
}