Name

fputws - writes a wide character string to a FILE stream

Library

libc.lib

Synopsis

  #include <stdio.h>
  #include <wchar.h>
  int fputws (const wchar_t * restrict ws, FILE * restrict fp);

Return values

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

Detailed description

The fputws function writes the wide character string pointed to by ws to the stream pointed to by fp.

Examples

#include <stdio.h>
#include <wchar.h>
/* Illustrates how to use fputws API */
int example_fputws(wchar_t *buf)
{
 FILE *fp = NULL;
 int retval;
 /* open the file for writing*/
 fp = fopen("write.txt","r");
 if(fp == NULL)
 {
  wprintf(L"Error: File open\n");
  return (-1);
 }
 /* Write the characters into the file */
 retval = fputws(buf, fp);
 /* Close the file open for writing */
 fclose(fp);
 /* return the number of characters written */
 /* into the file */
 return (retval);
}

         


Errors

The fputws function will fail if:
[EBADF]
  The fp argument supplied is not a writable stream.

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


Security considerations

Please refer fputs


See also

ferror, fputs, putwc,
The fputws function conforms to -p1003.1-2001.

Feedback

For additional information or queries on this page send feedback

© 2005-2007 Nokia

Top