Name

putws - writes a wide character string to stdout

Library

libc.lib

Synopsis

  #include <wchar.h>
  int putws (const wchar_t * restrict ws);

Return values

The putws function returns 0 on success and -1 on error.

Detailed description

The putws function writes the wide character string pointed to by ws to the stdout stream.


Examples

#include <stdio.h>
#include <wchar.h>
/* Illustrates how to use putws API */
int example_putws()
{
        wchar_t buf[12];
        FILE* op;
        FILE* stdop = freopen("c:\stdop","w+",stdout);
                
        putws(L"Hello World");          //write to stdout
        
        fclose(stdop);
                
        op = freopen("c:\stdop","r",stdout);
                
        fgetws(buf, 12, op);            //read from stdout
                
        fclose(stdop);
                
        remove("c:\stdop");
        
        if(!(wcsncmp(L"Hello World", buf, 11)))
                {                       
                return 0;
                }       
        return -1;
}
}

         


Errors

The putws function will fail if:
[EFAULT]
  The ws argument supplied is NULL.

The putws function may also fail and set errno for any of the errors specified for the routine write.


See also

ferror, fputws, fputs, putwc,

Feedback

For additional information or queries on this page send feedback

© 2008-2009 Nokia Corporation. All rights reserved. This documentation can be used in the connection with this Product to help and support the user.

Top