C Programming Tips & Tricks





Español Français 中文 Deutsch Portuguese Japanese nederlands
   
 
Code Snippets
 List All
 Arrays
 Calculators
 Datatypes
 Date & Time
 File Manipulation
 Math Functions
 Multimedia
 Others
 




Reading disk sector - C

Snippets  C  Reading disk sector
Snippet On
Disk Sector




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,&buffer) != 0)
printf(<q>Cannot read the A drive.\n</q>);
else
printf(<q>Drive A , Sector 1 read\n</q>);
return 0;
}

Output:
======
Insert disk in the A: drive, then press any key.
Drive A , Sector 1 read




Other Links

web hosting