C examples for wchar.h:fwscanf
function
<cwchar> <wchar.h>
Read formatted data from stream
int fwscanf (FILE* stream, const wchar_t* format, ...);
Parameter | Description |
---|---|
stream | Pointer to a FILE object |
format | C wide format string that follows the same specifications as format in scanf |
On success, the function returns the number of items of the argument filled.
#include <stdio.h> #include <wchar.h> int main ()/*from www . j a va 2 s . c o m*/ { wchar_t str [80]; float f; FILE * pFile; pFile = fopen ("main.cpp","w+"); fwprintf (pFile, L"%f %ls", 3.1416, L"PI"); rewind (pFile); fwscanf (pFile, L"%f", &f); fwscanf (pFile, L"%ls", str); fclose (pFile); wprintf (L"I have read: %f and %ls \n",f,str); return 0; }