Question: im having this error message * * * System Error: Block number 8 1 2 0 is invalid * * * System Error: Block number
im having this error message System Error: Block number is invalid
System Error: Block number is invalid
We have read characters from file DecOfInd.txt
We have read characters from file CommonSense.txt it should be ou are provided the file DATA as the file you are accessing and that contains the files IHaveADream.txt CommonSense.txt DecOfInd.txt Think of that file as the "hard drive".
The output will vary each run but at the end you should see:
We have read characters from file DecOfInd.txt
We have read characters from file CommonSense.txt #include
#include
#include
#include
#include
#include bioh
#include "fsLowSmall.h
#define MAXFCBS The maximum number of files open at one time
#define BCHUNKSIZE
typedef struct bfcb
fileInfo fi;
char buffer; Added buffer to hold data
int bufferposition; Added to keep track of position in buffer
bfcb;
bfcb fcbArrayMAXFCBS;
int startup ;
void binit
if startup return;
for int i ; i MAXFCBS; i
fcbArrayifi NULL;
fcbArrayibuffer NULL; Initialize buffer pointers
fcbArrayibufferposition ; Initialize buffer positions
startup ;
biofd bgetFCB
for int i ; i MAXFCBS; i
if fcbArrayifi NULL
fcbArrayifi fileInfo ;
return i;
return ; If no free FCB found
biofd bopenchar filename int flags
if startup binit;
biofd fd bgetFCB;
if fd return ; No available FCB
Get file info
fileInfo fileinfo GetFileInfofilename;
if fileinfo NULL return ; File not found
Allocate buffer
fcbArrayfdbuffer char mallocBCHUNKSIZE sizeofchar;
if fcbArrayfdbuffer NULL
freefileinfo;
return ; Memory allocation failed
fcbArrayfdfi fileinfo;
fcbArrayfdbufferposition ; Initialize buffer position
return fd;
int breadbiofd fd char buffer int count
if startup
binit;
if fd fd MAXFCBS
return ;
if fcbArrayfdfi NULL
return ;
int bytesread ;
int bytestoread ; Define bytestoread variable outside the loop
while count
if fcbArrayfdbufferposition
bytestoread BCHUNKSIZE count BCHUNKSIZE : count;
Call LBAread with appropriate parameters
int bytesreadfromdisk LBAread
fcbArrayfdbuffer, bytestoread,
fcbArrayfd
fifileSize; Assuming fileSize contains the file size
if bytesreadfromdisk
break;
fcbArrayfdbufferposition bytesreadfromdisk;
int bytestocopy fcbArrayfdbufferposition count
fcbArrayfdbufferposition
: count;
memcpybuffer bytesread, fcbArrayfdbuffer, bytestocopy;
bytesread bytestocopy;
count bytestocopy;
fcbArrayfdbufferposition bytestocopy;
fcbArrayfdbuffer bytestocopy;
return bytesread;
int bclosebiofd fd
if fd fd MAXFCBS fcbArrayfdfi NULL return ;
Free buffer memory
freefcbArrayfdbuffer;
fcbArrayfdbuffer NULL;
fcbArrayfdfi NULL;
fcbArrayfdbufferposition ;
return ;
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
