Question: Write a function that reads from a sequential file and writes to another sequential file. The file path and name are passed through arguments of

Write a function that reads from a sequential file and writes to another sequential file. The file path and name are passed through arguments of the main function. The function must be written using different files such as 'config.dat' an 'reverse.dat'. The real question will be posted after the explanation of the details that eed to be included within the function.

*******************

The information below is some information about how the function works and are some details about what needs to be included from the function.

int main(int argc, char *argv[])

For example, the file name is config.dat and the path is the current directory as shown from the schema of the file shown below:Write a function that reads from a sequential file and writes to

The function should read the file, one record at a time (from table). Each record has exactly 3 fields. The first field (call it: dType) contains the string: int, float or char. The second field (call it: dSize) contains an integer number. This integer is equal to the number of elements in the third field. The third field (call it: dSeq) contains a dSize number of dType elements (e.g. 12 integers, as shown below).

int 12 1 9 1 8 6 3 4 3 9 7 0

Each record can be stored into one of the following arrays depending on the type of the field,

int *iPtr; float *fPtr; char *cPtr; Date *dPtr;

The function must be able to basically read the table record by record. Each record must then have its data reverse its order

As a last step, it is needed to write out each reversed record to a file named reverse.dat. For example, the above example should be written as

int 12 0 7 9 3 4 3 6 8 1 9 1 float 2 56.31 5.30 chat 6 z o K y a h float 3 10.11 22.41 5.55 Date 2 2015-12-31 2016-03-21 int 12 1 9 1 8 6 3 4 3 9 7 0

*********************

Question: In other words and to sum, the original data needs to be put into a file named config. In this file, it then needs to be read and the data needs to be reversed as shown above. The reversed values then need to be stored into a file called reverse.dat. A program must be written following these two instructions.

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!