Starting from:

$30

CSC415-Assignment 5 Solved


 int b_open (char * filename, int flags);    //modified to accept flags
 int b_write (int fd, char * buffer, int count);
Your functions here will only use Linux I/O APIs. i.e. read, write, open, close (do not use the c library file functions).

The b_open should return a integer file descriptor (a number that you can track the file). You may want to also allocate the 512 byte buffer you will need for read operations here. Make sure though you know how to track the buffer for each individual file. You can return the same error code you receive if the Linux open returns an error.

The b_write takes a file descriptor, a buffer and the number of bytes to be written. The Operation of your b_write function must only write 512 bytes chunks at a time to the operating system from your own buffer, you will need to copy the appropriate bytes from the caller's buffer to your buffer. This means you may not even need to do a write to the actual file if your buffer is not yet full. Or, it may mean that you have a full buffer to write, then additional bytes to buffer from the caller’s buffer.
The return value is the number of bytes you have transferred from the caller’s buffer.
Hint: You may also need to track between calls where in the buffer you left off.

Limits: You can assume no more than 20 files open at a time.

Your main program is provided for you, please rename the file from Bierman_Robert_HW5_main.c to the appropriate naming for you. You are provided the file DecOfInd.txt as the file to read. The output file is nicely formatted in 75 or less character lines. The file ProvidedClean.txt provided is the correct output. 

More products