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 - 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
-
-
-
-
-
-
-
-
-
-
-
(Locked)
Reading from a file3m 31s
-
(Locked)
Writing to a file3m 40s
-
(Locked)
Challenge: Writing and reading files1m
-
(Locked)
Solution: Writing and reading files4m 4s
-
(Locked)
Working with raw data3m 4s
-
(Locked)
Using random file access3m 21s
-
(Locked)
Challenge: Access database records56s
-
(Locked)
Solution: Access database records2m 51s
-
(Locked)
Manipulating files2m 34s
-
(Locked)
Exploring the path1m 50s
-
(Locked)
Reading a directory3m 36s
-
(Locked)
Getting file information3m 26s
-
(Locked)
Chapter challenge: Managing files1m 46s
-
(Locked)
Chapter solution: Managing files2m 50s
-
(Locked)
-
-