/* Copyright (c) 2001-2009 by SoftIntegration, Inc. All Rights Reserved */
/* This is an example for putwc(wint_t, FILE*).  This function will write a 
  character to a stream.
*/
#include <wchar.h>

int main() {
    FILE *stream;
    wint_t wc;
    char *name;

    wc = 'i';
    if((name = tmpnam(NULL)) == NULL)
         printf("Error in creating temp file.\n");
    else {
     	fputs("Will write the letter '",stdout);
    	fputwc(wc, stdout);
    	fputs("' to a temporary file.\n", stdout); 
    	if((stream = fopen(name, "w")) != NULL) {
            printf("putwc(stream) = %c\n", putwc(wc,stream));
        }
    	else
            printf("Error in opening file!\n");
    }
    fclose(stream);
    remove(name);
}

