home *** CD-ROM | disk | FTP | other *** search
/ Microsoft Programmer's Library 1.3 / Microsoft-Programers-Library-v1.3.iso / sampcode / qc / qc25 / wrfile.c < prev   
Encoding:
C/C++ Source or Header  |  1989-11-15  |  303 b   |  17 lines

  1. /* WRFILE.C: Creates and writes to a disk file. */
  2. #include <stdio.h>
  3.  
  4. main()
  5. {
  6.    FILE *fp;
  7.  
  8.    if( (fp = fopen( "c:\\testfile.asc","w" )) != NULL )
  9.    {
  10.       fputs( "Example string", fp );
  11.       fputc( '\n', fp );
  12.       fclose( fp );
  13.    }
  14.    else
  15.       printf( "error message\n" );
  16. }
  17.