home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #31 / NN_1992_31.iso / spool / comp / sys / atari / st / tech / 6433 < prev    next >
Encoding:
Text File  |  1992-12-31  |  1.5 KB  |  58 lines

  1. Path: sparky!uunet!newsflash.concordia.ca!mizar.cc.umanitoba.ca!bison!sys6626!kynes1!rdo
  2. From: rdo@kynes.bison.mb.ca (Russell Ochocki)
  3. Newsgroups: comp.sys.atari.st.tech
  4. Subject: How do you set a disk's volume label?
  5. Message-ID: <H.ea.kYwLB_Rm3xg@kynes.bison.mb.ca>
  6. Date: Thu, 31 Dec 1992 11:24:26 CST
  7. Reply-To: rdo@kynes.bison.mb.ca
  8. Organization: Private Site, Winnipeg, Manitoba, Canada
  9. Lines: 46
  10. X-Software: HERMES GUS 1.04 Rev. Sep  5 1992
  11.  
  12. Using the following code, I can find the volume label on a disk:
  13.  
  14. #include <stdio.h>
  15. #include <string.h>
  16. #include <osbind.h>
  17. #include <ostruct.h>
  18.  
  19. /* Get disk vol for specified drive */
  20. char *
  21. getvol(char drive)
  22. {
  23.     _DTA    *dta;
  24.     char    path[8];
  25.     char    *vol = NULL;
  26.  
  27.     path[0] = '/';
  28.     path[1] = drive;
  29.     path[2] = '\0';
  30.     chdir(path);
  31.     Fsfirst("*.*", FA_LABEL);
  32.     do {
  33.         dta = (_DTA *)Fgetdta();
  34.         printf("name: %s\n", dta->dta_name);
  35.         if (dta->dta_attribute == FA_LABEL) {
  36.             vol = strdup(dta->dta_name);
  37.             break;
  38.         }
  39.     } while (Fsnext() == 0);
  40.  
  41.     if (vol != NULL)
  42.         return vol;
  43.     else
  44.         return NULL;    
  45. }
  46.  
  47. Now, what I'd like to do is be able to change an existing label.  Or, if one
  48. doesn't exist, I'd like to create it.
  49.  
  50. Any ideas?
  51. -- 
  52. ____________________________________________________________________________
  53. | _   /|  |  Russell Ochocki
  54. | \`o.0'  |  rdo@kynes.bison.mb.ca
  55. | =(___)= |-----------------------------------------------------------------
  56. |    U    |  A closed mouth gathers no foot.
  57. |_________|_________________________________________________________________
  58.