Examples for Open C Libraries |
This example illustrates how to redirect stdio to a file. libc library provides freopen API to redirect all standard IOs (namely, stderr, stdin, or stdout). Application first printf launching information at console and then open one file to redirect stdout using freopen. Calling freopen once more, user can change the filename during execution. This helps to redirect application printf messages into a log file.
TARGET redirectprintf.exe TARGETTYPE exe UID 0 0xA0001F1C CAPABILITY NONE VENDORID 0 SOURCEPATH ..\data START RESOURCE redirectprintf_reg.rss #ifdef WINSCW TARGETPATH \private\10003a3f\apps #else TARGETPATH \private\10003a3f\import\apps #endif END //RESOURCE SOURCEPATH ..\src SOURCE redirectprintf.c USERINCLUDE ..\inc SYSTEMINCLUDE \Epoc32\include SYSTEMINCLUDE \epoc32\include\stdapis STATICLIBRARY libcrt0.lib LIBRARY libc.lib LIBRARY libpthread.lib LIBRARY euser.lib