课程: Complete Guide to C Programming Foundations
今天就学习课程吧!
今天就开通帐号,24,100 门业界名师课程任您挑!
Chapter solution: Managing files - C教程
课程: Complete Guide to C Programming Foundations
Chapter solution: Managing files
(bright music) - [Instructor] Here is my solution to the chapter challenge starting with the create_file function. The file name is passed as constant character f. It's opened at line 10, line 11 tests for an error. If so, an error message is output and the program quits. Otherwise, a success message is output at line 16. Remember to output the success messages, otherwise, the code runs quietly and the user may not think anything is happening. Line 19 writes my name to the file. The printf statement sends the text to the file, opened as file handle fh. Then a text message is output confirming the operation. The file is closed. Again, a text message outputs success. Your function need not read exactly as shown here, but it must contain all of the steps. To confirm that the file was written, the read file function reads in the string. A buffer is required, which is declared at line 30. You see, I use the same size 32, so I could have set this size as a constant. I chose not to. The file…
内容
-
-
-
-
-
-
-
-
-
-
-
(已锁定)
Reading from a file3 分钟 31 秒
-
(已锁定)
Writing to a file3 分钟 40 秒
-
(已锁定)
Challenge: Writing and reading files1 分钟
-
(已锁定)
Solution: Writing and reading files4 分钟 4 秒
-
(已锁定)
Working with raw data3 分钟 4 秒
-
(已锁定)
Using random file access3 分钟 21 秒
-
(已锁定)
Challenge: Access database records56 秒
-
(已锁定)
Solution: Access database records2 分钟 51 秒
-
(已锁定)
Manipulating files2 分钟 34 秒
-
(已锁定)
Exploring the path1 分钟 50 秒
-
(已锁定)
Reading a directory3 分钟 36 秒
-
(已锁定)
Getting file information3 分钟 26 秒
-
(已锁定)
Chapter challenge: Managing files1 分钟 46 秒
-
(已锁定)
Chapter solution: Managing files2 分钟 50 秒
-
(已锁定)
-
-