home *** CD-ROM | disk | FTP | other *** search
/ Microsoft Programmer's Library 1.3 / Microsoft-Programers-Library-v1.3.iso / sampcode / c / other / learn / wrfile.c < prev   
Encoding:
C/C++ Source or Header  |  1988-10-07  |  305 b   |  18 lines

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