subject

For this lab, you are going to create two programs. The first program (named AsciiToBinary) will read data from an ASCII file and save the data to a new file in a binary format. The second program (named BinaryToAscii) will read data from a binary file and save the data to a new file in ASCII format. Background Preparation: Review file I/O for ascii and binary formatsSpecifications:Your programs will use the following structure to hold the data that is read and to be written:typedef struct _FileData{int a;double b;char dataStr[56];} FileData;Both programs will obtain the filenames to be read and written from command line parameters:bash$ AsciiToBinary ascii_in binary_outbash$ BinaryToAscii binary_in ascii_outThe data format in the ASCII format files (both reading and writing) will be one data item per line:4734.278This is a line of textA sample ASCII format file is provided. There will be a set of three lines for each FileData structure's data. There will be no blank lines between each set of three lines. The size of each record for the binary file will be the same as the size of the FileData structure. The specific method that you use to read and write the data is up to you. You may wish to read all the data from the input file before writing to the output file, or you may wish to write each record as it is read. Be sure to close both files (input and output) before exiting the program. Testing:Besides testing your code with your usual methods, you should also test your programs by reading an ASCII file, converting it to binary, then reading the binary file and converting it to ASCII. The new ASCII file should match exactly with the original ASCII file

ansver
Answers: 2

Other questions on the subject: Computers and Technology

image
Computers and Technology, 22.06.2019 01:00, zuleromanos
)a grad student comes up with the following algorithm to sort an array a[1..n] that works by first sorting the first 2/3rds of the array, then sorting the last 2/3rds of the (resulting) array, and finally sorting the first 2/3rds of the new array. 1: function g-sort(a, n) . takes as input an array of n numbers, a[1..n] 2: g-sort-recurse(a, 1, n) 3: end function 4: function g-sort-recurse(a, `, u) 5: if u ⒠` ≤ 0 then 6: return . 1 or fewer elements already sorted 7: else if u ⒠` = 1 then . 2 elements 8: if a[u] < a[`] then . swap values 9: temp ↠a[u] 10: a[u] ↠a[`] 11: a[`] ↠temp 12: end if 13: else . 3 or more elements 14: size ↠u ⒠` + 1 15: twothirds ↠d(2 ◠size)/3e 16: g-sort-recurse(a, `, ` + twothirds ⒠1) 17: g-sort-recurse(a, u ⒠twothirds + 1, u) 18: g-sort-recurse(a, `, ` + twothirds ⒠1) 19: end if 20: end function first (5 pts), prove that the algorithm correctly sorts the numbers in the array (in increasing order). after showing that it correctly sorts 1 and 2 element intervals, you may make the (incorrect) assumption that the number of elements being passed to g-sort-recurse is always a multiple of 3 to simplify the notation (and drop the floors/ceilings).
Answers: 3
image
Computers and Technology, 22.06.2019 16:30, mesposito
Technician a says that a dry sump system uses no oil storage sump under the engine. technician b says that a wet sump system uses no oil storage sump under the engine. who is correct?
Answers: 3
image
Computers and Technology, 22.06.2019 19:30, bstine6678
When creating a presentation in libre office impress, where does the editing of slides take place? a. the slides panel b. the center panel c. the tasks panel, under the masters pages tab d. the tasks panel, under the layouts tab
Answers: 1
image
Computers and Technology, 23.06.2019 05:30, savyblue1724707
Sally is editing her science report about living things. she needs to copy a paragraph from her original report. order the steps sally needs to do to copy the text to her new document.
Answers: 1
You know the right answer?
For this lab, you are going to create two programs. The first program (named AsciiToBinary) will rea...

Questions in other subjects:

Konu
Mathematics, 07.06.2021 17:10
Konu
Mathematics, 07.06.2021 17:10
Konu
Computers and Technology, 07.06.2021 17:10