home *** CD-ROM | disk | FTP | other *** search
/ Fresh Fish 8 / FreshFishVol8-CD1.bin / useful / dev / c / cmanual / system / amigados / example3.c < prev    next >
C/C++ Source or Header  |  1993-10-12  |  2KB  |  52 lines

  1. /***********************************************************/
  2. /*                                                         */
  3. /* Amiga C Encyclopedia (ACE) V3.0      Amiga C Club (ACC) */
  4. /* -------------------------------      ------------------ */
  5. /*                                                         */
  6. /* Book:    ACM System                  Amiga C Club       */
  7. /* Chapter: AmigaDOS                    Tulevagen 22       */
  8. /* File:    Example3.c                  181 41  LIDINGO    */
  9. /* Author:  Anders Bjerin               SWEDEN             */
  10. /* Date:    92-05-02                                       */
  11. /* Version: 1.10                                           */
  12. /*                                                         */
  13. /*   Copyright 1992, Anders Bjerin - Amiga C Club (ACC)    */
  14. /*                                                         */
  15. /* Registered members may use this program freely in their */
  16. /*     own commercial/noncommercial programs/articles.     */
  17. /*                                                         */
  18. /***********************************************************/
  19.  
  20. /* This example demonstrates how to rename files and directories. It  */
  21. /* will rename the file Example 1 created (called "HighScore.dat") to */
  22. /* "Numbers.dat". It will also rename the directory Example 2 created */
  23. /* ("MyDirectory") to "NewDirectory".                                 */ 
  24.  
  25.  
  26. /* This file declares the type BOOL: */
  27. #include <exec/types.h>
  28.  
  29.  
  30. void main();
  31.  
  32. void main()
  33. {
  34.   BOOL ok;
  35.  
  36.  
  37.   /* Rename the file: */
  38.   ok = Rename( "RAM:HighScore.dat", "RAM:Numbers.dat" );
  39.  
  40.   /* Check if the file was successfully renamed: */
  41.   if( !ok )
  42.     printf( "The file could not be renamed!\n" );
  43.  
  44.  
  45.   /* Rename the directory: */
  46.   ok = Rename( "RAM:MyDirectory", "RAM:NewDirectory" );
  47.  
  48.   /* Check if the directory was successfully renamed: */
  49.   if( !ok )
  50.     printf( "The directory could not be renamed!\n" );
  51. }
  52.