Previous Book Contents Book Index Next

Inside Macintosh: Files /
Chapter 5 - Disk Initialization Manager / Disk Initialization Manager Reference
Routines / Low-Level Disk Initialization Routines


To format a disk, you can use the DIFormat function.

FUNCTION DIFormat (drvNum: Integer): OSErr;
The number of the drive containing the disk to be formatted.
The DIFormat function attempts to format the disk in the drive specified by the drvNum parameter and returns a result code indicating whether it completed the formatting successfully or failed. Formatting a disk consists of writing special information onto it
so that the disk driver can read from and write to the disk.

You can use DIFormat to format any unlocked disk, including single-sided disks, double-sided disks, high-density disks, and hard disk drives. It formats both sides
of a double-sided disk.

You have to unmount a disk before calling the DIFormat function.

The trap macro and routine selector for DIFormat are
Trap macroSelector

You should not call DIFormat at interrupt time.

noErr0No error
volOnLinErr-55Volume is online
lastDskErr-64Last of the range of low-level disk errors
firstDskErr-84First of the range of low-level disk errors

Previous Book Contents Book Index Next

© Apple Computer, Inc.
2 JUL 1996