Question: Write a C function, makeData (char *fileName, int N), which writes the the integers 1 to N to a new file named in the

Write a C function, makeData (char *fileName, int N), which writes the 

Write a C function, makeData (char *fileName, int N), which writes the the integers 1 to N to a new file named in the string fileName. The integers should be separated by spaces but no more than 5 integers are to be written to a single line. For example, if the function was called with N=12 the file would contain: 1 2 3 4 5 6 7 8 9 10 11 12 It does not matter if a space character appears at the end of the line or not. Your function must open the file with fopen(), write the data with fprintf (), then, before returning, close the file with fclose(). It does not need to perform any error handling. The function prototypes for the functions above are: FILE *fopen (const char *pathname, const char *mode); int fprintf (FILE *stream, const char *format, ...);\. int fclose (FILE *stream);

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 Programming Questions!