Skip to main content

1. Write the following functions, and then write a program that tests them. Your code should use C’s binary file random access functions to perform the required tasks. A sample binary file of random integers is available to you (lab10BinFile.dat), and a corresponding text file is provided so that you will be able to check your work.

Note: The functions should assume that all file ptrs point to files that are already open in the appropriate mode (input and/or output) for the function’s task.

a. A function that prints all items from a binary file of integers. Use the following prototype:

void print_bin_file(FILE *fileptr);

b. A function that returns the number of integers in a binary file of integers. Use file positioning functions, and do not read any of the integers. The function should take a pointer to the file as its argument. Use the following prototype:

int count_elements (FILE *fptr);

c. A function that returns the last integer in a binary file of integers. Use no more than one read statement, which should read only the integer in question. The function should take a pointer to the file as its argument. Use the following prototype:

int get_last(FILE *fptr);

d. A function that returns the nth integer in a binary file of integers. In main, prompt the user to enter n, and ensure that n is between 1 and the number of integers in the file before calling the function.

int get_nth(FILE *fptr, int n);

e. A function that copies one binary file of integers to a second file. The function should take pointers to the source and destination files as its arguments.

 

void copy_file(FILE *source_ptr, FILE *target_ptr);



Comments

Popular posts from this blog

Netanel (1996) talks about the NIEP theory approach to copyright and the democratic paradigm. Explain the difference between these in your own words. Lessig (2008) talks about read-only (RO) and read/write (RW) culture. How can copyright facilitate both of these?

chapter one Introduction A ‘‘Largely Ignored Paradox’’ The u.s. supreme court has famously labeled copyright ‘‘the engine of free expression.’’1 Copyright law, the Court tells us, provides a vital economic incentive for the creation and distribution of much of the literature, commentary, music, art, and film that makes up our public discourse. Yet copyright also burdens speech. We often copy or build upon another’s words, images, or music to convey our own ideas effectively. We cannot do that if a copyright holder withholds permission or insists upon a license fee that is beyond our means. And copyright does not extend merely to literal copying. It can also prevent parodying, remolding, critically dissecting, or incorporating portions of existing expression into a new, independently created work. Consider The Wind Done Gone, a recent, best-selling novel by African American writer Alice Randall. Randall’s novel revisits the setting and characters of Margaret Mitchell’s classic Civil War

Explain why HAMILTON is considered “a cultural monument?”

  Module 7: Theatre Now: Steps Toward Diversity Chapter Questions Read Chapter 9 “Musicals of the Twenty-First Century” (pages 244 to 246) and Chapter 10 (pages 247 to 260) in your textbook. Choose only 5 of these questions to answer. Write your answers in your own words; if you choose to quote from the textbook, remember to identify the source. Question # Chapter Questions 1 9 Explain how Broadway musicals have changed in the 21st century. 2 9 Explain why HAMILTON is considered “a cultural monument?” 3 10 Identify the current focus/topics of the American theatre’s social awareness. 4 10 Give an example of how current theatre is addressing inequality in each of these areas: (a) gender and sexuality (b) racism (c) access to theatre for people with disabilities 5 10 How has theatre moved from its pre-1960s attitude that plays must not be open about the Love that dare not speak its name? [This expression was first used by Lord Alfred Douglas in his 1894 poem, “Two Loves” written in refere

CBS Undercover Boss website

  Go to the CBS   Undercover Boss   website and search for a full episode of the show. Imagine you are the CEO of the company in the selected episode.  please do this with 2 pages Provide a detailed comparison of two job positions from the episode. Perform a job analysis of each position. Provide a clear, detailed description of your method of collecting the information for the job analysis. Examples include one-on-one, interview, or survey. Create a detailed job description from the two positions you analyzed. Provide clear, conclusive rationale for why the job analyses and job descriptions comply with state and federal regulations. Support your propositions, assertions, arguments, or conclusions with at least three credible, relevant, and appropriate sources synthesized in a coherent analysis. Cite each source on your source list at least once within your assignment. For help with research, writing, and citation, access the  library  or review  library guides . Write clearly and conc