Reading disk sector - C

Disk Sector

Snippet Code


  
Rate this page :
  [ 0 votes]

#include <stdio.h> #include <dos.h> #include <stdlib.h> #include <bios.h> int main(void) { unsigned char buffer[512]; clrscr(); printf(<q>Insert disk in the A: drive, then press any key.n</q>); /*wait for keypress*/ getch(); if(absread(0,1,1,ampbuffer) != 0) printf(<q>Cannot read the A drive.n</q>); else printf(<q>Drive A , Sector 1 readn</q>); return 0; } Output: ====== Insert disk in the A: drive, then press any key. Drive A , Sector 1 read

Tags


Ask Questions

Ask Question