介绍
在本实验中,我们将学习如何在 C 编程语言中查找任何文件的大小。我们将使用 fseek()
和 ftell()
函数来查找文件的大小。
注意:你需要自己创建文件
~/project/main.c
来练习编码,并学习如何使用 gcc 编译和运行它。
cd ~/project
## 创建 main.c
touch main.c
## 编译 main.c
gcc main.c -o main
## 运行 main
./main
Skills Graph
%%%%{init: {'theme':'neutral'}}%%%%
flowchart RL
c(("C")) -.-> c/BasicsGroup(["Basics"])
c(("C")) -.-> c/FileHandlingGroup(["File Handling"])
c(("C")) -.-> c/UserInteractionGroup(["User Interaction"])
c(("C")) -.-> c/ControlFlowGroup(["Control Flow"])
c(("C")) -.-> c/PointersandMemoryGroup(["Pointers and Memory"])
c(("C")) -.-> c/FunctionsGroup(["Functions"])
c/BasicsGroup -.-> c/variables("Variables")
c/ControlFlowGroup -.-> c/if_else("If...Else")
c/PointersandMemoryGroup -.-> c/pointers("Pointers")
c/PointersandMemoryGroup -.-> c/memory_address("Memory Address")
c/FunctionsGroup -.-> c/function_declaration("Function Declaration")
c/FileHandlingGroup -.-> c/write_to_files("Write To Files")
c/FileHandlingGroup -.-> c/create_files("Create Files")
c/FileHandlingGroup -.-> c/read_files("Read Files")
c/UserInteractionGroup -.-> c/output("Output")
subgraph Lab Skills
c/variables -.-> lab-123313{{"查找任意文件大小的程序"}}
c/if_else -.-> lab-123313{{"查找任意文件大小的程序"}}
c/pointers -.-> lab-123313{{"查找任意文件大小的程序"}}
c/memory_address -.-> lab-123313{{"查找任意文件大小的程序"}}
c/function_declaration -.-> lab-123313{{"查找任意文件大小的程序"}}
c/write_to_files -.-> lab-123313{{"查找任意文件大小的程序"}}
c/create_files -.-> lab-123313{{"查找任意文件大小的程序"}}
c/read_files -.-> lab-123313{{"查找任意文件大小的程序"}}
c/output -.-> lab-123313{{"查找任意文件大小的程序"}}
end