/************************************************************************ * * * Copyright Digital Equipment Corporation 1998. All rights reserved. * * * * Restricted Rights: Use, duplication, or disclosure by the U.S. * * Government is subject to restrictions as set forth in subparagraph * * (c) (1) (ii) of DFARS 252.227-7013, or in FAR 52.227-19, or in FAR * * 52.227-14 Alt. III, as applicable. * * * * This software is proprietary to and embodies the confidential * * technology of Digital Equipment Corporation. Possession, use, or * * copying of this software and media is authorized only pursuant to a * * valid written license from Digital or an authorized sublicensor. * * * ************************************************************************/ /* fgetws_example.c */ #include #include #include #include #include main() { wchar_t wstr[80], *ret; FILE *fp; /* Create a dummy data file */ if ((fp = fopen("file.dat", "w+")) == NULL) { perror("open"); exit(1); } fprintf(fp, "this is a test\n") ; fclose(fp) ; /* Open a test file containing : "this is a test" */ if ((fp = fopen("file.dat", "r")) == (FILE *) NULL) { perror("File open error"); exit(EXIT_FAILURE); } ret = fgetws(wstr, 80, fp); if (ret == (wchar_t *) NULL) { perror("fgetws failure"); exit(EXIT_FAILURE); } fputws(wstr, stdout); fclose(fp); delete("file.dat"); }