home *** CD-ROM | disk | FTP | other *** search
/ Fish 'n' More 2 / fishmore-publicdomainlibraryvol.ii1991xetec.iso / fish / code_examples / cmanual_456 / amigados / example3.c < prev    next >
C/C++ Source or Header  |  1991-01-12  |  887b  |  34 lines

  1. /* Example 3                                                          */
  2. /* This example demonstrates how to rename files and directories. It  */
  3. /* will rename the file Example 1 created (called "HighScore.dat") to */
  4. /* "Numbers.dat". It will also rename the directory Example 2 created */
  5. /* ("MyDirectory") to "NewDirectory".                                 */ 
  6.  
  7.  
  8. /* This file declares the type BOOL: */
  9. #include <exec/types.h>
  10.  
  11.  
  12. void main();
  13.  
  14. void main()
  15. {
  16.   BOOL ok;
  17.  
  18.  
  19.   /* Rename the file: */
  20.   ok = Rename( "RAM:HighScore.dat", "RAM:Numbers.dat" );
  21.  
  22.   /* Check if the file was successfully renamed: */
  23.   if( !ok )
  24.     printf( "The file could not be renamed!\n" );
  25.  
  26.  
  27.   /* Rename the directory: */
  28.   ok = Rename( "RAM:MyDirectory", "RAM:NewDirectory" );
  29.  
  30.   /* Check if the directory was successfully renamed: */
  31.   if( !ok )
  32.     printf( "The directory could not be renamed!\n" );
  33. }
  34.