CS609_ Assignment No.3, Solution & Discussion. Due Date: … July 2019

This topic contains 0 replies, has 1 voice, and was last updated by  مَلیکا ایمان 1 month, 1 week ago.

  • Author
    Posts
  • #6904

    CS609_ Assignment No.3,

    Solution & Discussion.

    Due Date: ….. July  2019

    Question: Write a program which reads two physically addressed blocks from disk using biosdisk() function.

    Solution:

    #include <bios.h>

    #include <dos.h>

    FILE *fp;

    unsigned char buf[1024];

    unsigned char st[60];

    unsigned char headno[10];

    unsigned char secno[10];

    unsigned char trackno[10];

    void main (void)

    {

    int i;

    for (i=0; i<1024; i++)

    buf=0;

    gets(st);

    fp=fopeon(st,”wb”);

    printf(“Head”);

    gets(headno);

    puts(headno);

    printf(“/nsector ”);

    gets(secno);

    puts(secno);

    printf(“/ntrack ”);

    gets(trackno);

    puts(trackno);

    i = biosdisk(2, 0x80, atoi(headno), atoi(trackno), atoi(trackno), 2,buf);

    }

    if(*(((char *)(&i))+1)= =0)

    {

    fwrite(buf,2,1024,fp);

    fclose(fp);

    }

    else

    {

    printf(“cannot read errors# = %x” i);

    }

    Attachments:

You must be logged in to reply to this topic.

©[2019] All rights reserved to Buraqq.com

Log in with your credentials

or    

Forgot your details?

Create Account