#include <wchar.h>
|
|
FILE *
wfreopen (const wchar_t * path, const wchar_t * mode, FILE *stream); |
If the path argument is NULL, wfreopen attempts to re-open the file associated with stream with a new mode. The new mode must be compatible with the mode that the stream was originally opened with:
The primary use of the wfreopen function is to change the file associated with a standard text stream (stderr, stdin, or stdout).
/* wfreopen example: redirecting stdout */
#include <stdio.h>
#include <wchar.h>
int main ()
{
wfreopen (L"c:\myfile.txt",L"w",stdout);
printf ("This sentence is redirected to a file.");
fclose (stdout);
return 0;
}
Contents of myfile.txt:This sentence is redirected to a file.
The output here is redirected from stdout to file myfile.txt
| [EINVAL] | |
| The mode argument to wfreopen, was invalid. | |
The wfreopen function may also fail and set errno for any of the errors specified for the routine wopen.
|
© 2007-2009 Nokia Corporation. All rights reserved. This documentation can be used in the connection with this Product to help and support the user. |
|