Latest Activity In Study Groups

Join Your Study Groups

VU Past Papers, MCQs and More

We non-commercial site working hard since 2009 to facilitate learning Read More. We can't keep up without your support. Donate.

CS609 Assignment No 03 Fall 2020 Solution & Discussion Due Date: 28-01-2021

Problem Statement:
Write a complete C program that will read the physical block of the Hard Drive / Removable Drive
based on last two digits of your student ID using biosdisk() function and write the data in a file
using fwrite() function. (See detailed instructions)
Detailed Instructions:
1) If last two digits of your Student ID is even (for example in BC123456788, last two digits are 88
and 88 is even) then your program will read the block from first fixed drive of your system
2) If last two digits of your Student ID is odd (for example in BC123456783, last two digits are 83
and 83 is odd) then your program will read the block from first removable drive of your system
3) To read a physical block of the hard disk, we will use biosdisk() function. This function
requires several parameters which are given below:


Parameters Parameter values
Command operation 2 (read the disk)
Head number Get from the user at run time
Track number Get from the user at run time
Sector number Get from the user at run time
Next sectors to read 1 (current only)
Buffer to read Fixed size of 512 bytes
(initialize it with zeros)
4) Values inputted by the user (Head, Track, and Sector numbers) must be converted to integer
values
5) After successfully reading into the buffer, write the data in a file using fwrite() function. Take
name of the file from user at runtime. Open the file in Write/Binary format
6) Also perform error checking during disk read operation. If, for some reason, disk is not read,
the relevant error message should be displayed instead of abnormal termination of the
program

Sample Output:

Case 1: If last two digits of Student ID is EVEN:
Suppose the last 2 digits of your Student ID is 88 and 88 is even. Student will read data from first
fixed drive of his/her system. Following is the sample screenshot of desired final output. The values
entered by the user is for example only:

Case 2: If last two digits of Student ID is ODD:
Output will be exactly the same as in above screenshot. The only difference is that Student will read
from first removable disk.
Creation of File after running the program:
In either case (even or odd), when you successfully run the program, a file will be created in C: >
TURBOC3 > BIN folder as in the following screenshot:

Views: 675

Attachments:

Replies to This Discussion

Share the Assignment Questions & Discuss Here.... 

Stay touched with this discussion, Solution idea will be uploaded as soon as possible in replies here before the due date.

 

CS609_Assignment_No_03_Solution_Fall_2020

Click on the below link to download the file

CS609_Assignment_No_03_Solution_Fall_2020

cs609 assignment 3 fall 2020 cs609 assignment no3 fall 2020 cs609 assignment solution cs609 assignment no 3 solution 2020 cs609 solved assignment 2020 cs609 assignment solution last date 28 jan 2021

CS609 Assignment 3 Fall 2020 Solution idea:

 

Code:

#include <bios.h>

#include <dos.h>

#include <stdio.h>

FILE *fp;

unsigned char buf[512];




unsigned char st[60];

unsigned char headno[10 ];

unsigned char secno[10 ];




unsigned char unsigned char trackno[10 ] ;

void main (void)

{

int i;

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

buf[i] = 0;

printf("Please Enter Name ot the file);

gets(st);

fp=fopen(st,"wb");




printf("Please Enter Head Number:");

gets(headno);




printf("Please Enter Sector Number:");

gets(secno);




printf("Please Enter Track Number");

gets(trackno);




i = biosdisk(2,0x00,atoi(headno), atoi(trackno),atoi(secno),1, buf) ;

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

{

fwrite(buf,1,512,fp);

fclose(fp);




printf("Data is Written Successfully on the file");

}

else

{

printf("Cannot Read Error",i);

}

getch();

}

Cs609 assignment no 3 solution

If you find any mistake please correct it by yourself.

Regards.

Solution :-

#include <bios.h>

#include <dos.h>

#include <stdio.h>

FILE *fp;

unsigned char buf[512];

unsigned char st[60];

unsigned char headno[10 ];

unsigned char secno[10 ];

unsigned char unsigned char trackno[10 ] ;

void main (void)

{

int i;

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

buf[i] = 0;

printf("Please Enter Name ot the file);

gets(st);

fp=fopen(st,"wb");

printf("Please Enter Head Number:");

gets(headno);

printf("Please Enter Sector Number:");

gets(secno);

printf("Please Enter Track Number");

gets(trackno);

i = biosdisk(2,0x00,atoi(headno), atoi(trackno),atoi(secno),1, buf) ;

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

{

fwrite(buf,1,512,fp);

fclose(fp);

printf("Data is Written Successfully on the file");

}

else

{

printf("Cannot Read Error",i);

}

getch();

}

CS609 Assignment 3 Solution-converted

Click on the below link to download the file

CS609 Assignment 3 Solution-converted

RSS

Looking For Something? Search Below

Latest Activity

+ M.Tariq Malik liked + M.Tariq Malik's discussion BT505 Biosensors Final Term Papers Mega Files - Solved MCQs, Short Notes, Solved Past Papers & More
32 minutes ago
+ M.Tariq Malik's 63 discussions were featured
32 minutes ago
+ M.Tariq Malik added a discussion to the group BT505 Biosensors
33 minutes ago
+ M.Tariq Malik liked + M.Tariq Malik's discussion BT504 Genomics and Proteomics Final Term Papers Mega Files - Solved MCQs, Short Notes, Solved Past Papers & More
37 minutes ago
+ M.Tariq Malik added a discussion to the group BT504 Genomics and Proteomics
37 minutes ago
+ M.Tariq Malik liked + M.Tariq Malik's discussion BT503 Environment Biotechnology Final Term Papers Mega Files - Solved MCQs, Short Notes, Solved Past Papers & More
38 minutes ago
+ M.Tariq Malik liked + M.Tariq Malik's discussion BT501 Health Biotechnology Final Term Papers Mega Files - Solved MCQs, Short Notes, Solved Past Papers & More
38 minutes ago
+ M.Tariq Malik added a discussion to the group BT503 Environment Biotechnology
38 minutes ago

VIP Member Badge & Others

How to Get This Badge at Your Profile DP

------------------------------------

Management: Admins ::: Moderators

Other Awards Badges List Moderators Group

© 2021   Created by + M.Tariq Malik.   Powered by

Promote Us  |  Report an Issue  |  Privacy Policy  |  Terms of Service