home *** CD-ROM | disk | FTP | other *** search
/ World of A1200 / World_Of_A1200.iso / datafiles / text / c_manual / system / amigados / example2.c < prev    next >
C/C++ Source or Header  |  1995-02-27  |  2KB  |  50 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:    Example2.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 create a directory called */
  21. /* "MyDirectory" on the RAM disk.                             */
  22.  
  23.  
  24. #include <libraries/dos.h>
  25.  
  26.  
  27. void main();
  28.  
  29. void main()
  30. {
  31.   /* Declare a FileLock structure: */
  32.   struct FileLock *lock;
  33.  
  34.   /* Create a directory on the RAM disk: (The directory will */
  35.   /* be locked with an exclusive lock, and must therefore be */
  36.   /* unlocked before the program terminates.)                */
  37.   lock = (struct FileLock *) CreateDir( "RAM:MyDirectory" );
  38.  
  39.   /* If there is no lock, no directory has been created. In  */
  40.   /* that case, inform the user about the problem and leave: */
  41.   if( lock == NULL )
  42.   {
  43.     printf( "ERROR Could NOT create the new directory!\n" );
  44.     exit( 0 );
  45.   }
  46.  
  47.   /* Unlock the directory: */
  48.   UnLock( lock );
  49. }
  50.