Bookmark:Win32/WinCE Standard I/O Redirection in C program

Windows platform

 Creating a Child Process with Redirected Input and Output

Key point: SetStdHandle(), GetStdHandle 

Windows Embedded CE Platform 

On WinCE 4.2 or later use both GetStdioPathW() & SetStdioPathW()

Headed File: #include <Pkfuncs.h>

TargetLib : Coredll.lib

PocketPC: not have a standard console, kernel still support the function,

but Symbolictools provide a PocketPC console



to read "fopen.c", "stdioinit.c(implement stdlib)", "kmisc.c(Implement GetStdioPath/SetStdioPath)" under private directory can find out a _wfreopen() function in CRT(C RunRime library) to redirection stdin/stdin/stderr

Technorati tags: , ,

// testIOredir.cpp : Defines the entry point for the console application.
// The demo program can redirection stdout stream to "\.test.txt" file
// so can use the feature to implement a simple log mech.
// Test passed on Pocket2003 Emulator

#include "stdafx.h"
#include <windows.h>
#include <stdio.h>
#include <commctrl.h>

int _tmain(int argc, _TCHAR* argv[])

    FILE* fp;
    fp = _tfreopen(L"test.txt", L"w+", stdout);
    if (fp == NULL)

    printf("The program just to test I/O redirectionrn");
    return 0;



ref : , C Standard function



在下方填入你的資料或按右方圖示以社群網站登入: 標誌

您的留言將使用 帳號。 登出 /  變更 )

Google+ photo

您的留言將使用 Google+ 帳號。 登出 /  變更 )

Twitter picture

您的留言將使用 Twitter 帳號。 登出 /  變更 )


您的留言將使用 Facebook 帳號。 登出 /  變更 )


連結到 %s