Question: C - Program I need help writting a function in C that is given a dictionary name, word to find, and length of each line

C - Program

I need help writting a function in C that is given a dictionary name, word to find, and length of each line in file. Only using read, write, and lseek see if the word to find is in the file.

int search(char *dictonaryName, char *word, int length).

Other requirements: dictionary format is 1 word per line and lines are in ascending sorted alphabetical order. Use binary search.

If the word is found return the line number of the word and if it is not present it should return the negative number of the last line searched.

What I have so far: discard int line_number and char buffer[512]

C - Program I need help writting a function in C that

help please! Thanks in advanced.

int ok(char *dictionaryName, char *word, int length) { FILE *fd; int line_num = 1; char buffer[512]; // open the dictionary file int fd = fopen(dictionaryName, O_RDONLY, @); if( fd

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!