/* Copyright (c) 2001-2009 by SoftIntegration, Inc. All Rights Reserved */
/* This is an example of the function fputwc(wint_t, FILE *).  This will insert
   a wide character into the specifed output destination.  
*/
#include <wchar.h>

int main() {
    FILE *stream;
    wint_t wc;
    char *name;
    
    if((name = tmpnam(NULL)) == NULL)
   	printf("Error in creating temp file.\n");
    else {
	wc = 'i';
    	printf("Will write the character 'i' to to a temporary file.\n"); 
    	if((stream = fopen(name, "w")) != NULL) {
            printf("fputwc(stream) = ");
            fputwc(wc,stream);
 	    fputwc(wc,stdout);
            printf("\n");
        }
     	else
	    printf("Error in opening file!\n");
    }
    fclose(stream);
    remove(name);
}

