From the course: Complete Guide to C Programming Foundations

Unlock the full course today

Join today to access over 24,500 courses taught by industry experts.

Chapter challenge: Managing files

Chapter challenge: Managing files - C Tutorial

From the course: Complete Guide to C Programming Foundations

Chapter challenge: Managing files

(ethereal music) - [Instructor] Here's the skeleton for this chapter's challenge, which is available in the exercise files. You see a main function that declares constant character filename. Three functions are called, but they're yet to be written: create_file(), which creates the named file and writes data to it, read_file(), which reads data from the file created, and delete_file(), which removes the file. Your task is to code all three functions. Code the create_file() function. Open the named file for writing. Write your name to the file. Close the file. And after each step, output text to inform the user of the program's progress. Code the read_file() function. Open the named file for reading. Read text from the file, storing it in a buffer. Output the text read from the file. Close the file. And once more, after each step, output a message informing the user of the program's progress. Finally, code the delete_file() function. Use the unlink() function to remove the named file…

Contents