Write a program (in a single .c file) with a queue of strings implemented using array. You should write ite a queue type. The program reads a set of strings stored in a file (filename given on command line as argument) and inserts each string in the queue. Then it removes each string and writes it to another file (also given as second argument on command line).
Note: for this particular assignment, you must use open(), read(), write() calls and use of fopen(), fread(), etc functions is not allowed.
* This problem involves some thinking about combinging the various different concepts about files, queues, data type implementation, array handling, etc.
* You have to implement a queue type which means, write the code for enqueue(), dequeue(), etc functions of the queue. This has to be done using an array and indexes as required, AND NOT using structures, pointers, and malloc as done in the class. You can refer to the way we've written stack.
* The program essentially copies a file into another. However before data goes from one file to another, it is temporarily stored in the queue of strings.
* The known functinos like read(), write() etc do not recognize strings. String is a char array terminated by NUL character. The read(), write() functions simply read some bytes from the file. So you will be required to process the data read from the file also.
All 2 Replies
Be a part of the DaniWeb community
We're a friendly, industry-focused community of 1.21 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.