Introduction
In this lab, we will learn how to find the size of any file in C programming language. We will use fseek()
and ftell()
functions to find the size of the file.
Note: You need to create the file ~/project/main.c
yourself to practice coding and learn how to compile and run it using gcc.
cd ~/project
## create main.c
touch main.c
## compile main.c
gcc main.c -o main
## run main
./main
Skills Graph
%%%%{init: {'theme':'neutral'}}%%%%
flowchart RL
c(("`C`")) -.-> c/UserInteractionGroup(["`User Interaction`"])
c(("`C`")) -.-> c/BasicsGroup(["`Basics`"])
c(("`C`")) -.-> c/ControlFlowGroup(["`Control Flow`"])
c(("`C`")) -.-> c/PointersandMemoryGroup(["`Pointers and Memory`"])
c(("`C`")) -.-> c/FunctionsGroup(["`Functions`"])
c(("`C`")) -.-> c/FileHandlingGroup(["`File Handling`"])
c/UserInteractionGroup -.-> c/output("`Output`")
c/BasicsGroup -.-> c/variables("`Variables`")
c/BasicsGroup -.-> c/data_types("`Data Types`")
c/BasicsGroup -.-> c/operators("`Operators`")
c/ControlFlowGroup -.-> c/if_else("`If...Else`")
c/PointersandMemoryGroup -.-> c/pointers("`Pointers`")
c/FunctionsGroup -.-> c/function_parameters("`Function Parameters`")
c/FunctionsGroup -.-> c/function_declaration("`Function Declaration`")
c/FileHandlingGroup -.-> c/create_files("`Create Files`")
c/FileHandlingGroup -.-> c/write_to_files("`Write To Files`")
c/FileHandlingGroup -.-> c/read_files("`Read Files`")
subgraph Lab Skills
c/output -.-> lab-123313{{"`Program to Find Size of Any File`"}}
c/variables -.-> lab-123313{{"`Program to Find Size of Any File`"}}
c/data_types -.-> lab-123313{{"`Program to Find Size of Any File`"}}
c/operators -.-> lab-123313{{"`Program to Find Size of Any File`"}}
c/if_else -.-> lab-123313{{"`Program to Find Size of Any File`"}}
c/pointers -.-> lab-123313{{"`Program to Find Size of Any File`"}}
c/function_parameters -.-> lab-123313{{"`Program to Find Size of Any File`"}}
c/function_declaration -.-> lab-123313{{"`Program to Find Size of Any File`"}}
c/create_files -.-> lab-123313{{"`Program to Find Size of Any File`"}}
c/write_to_files -.-> lab-123313{{"`Program to Find Size of Any File`"}}
c/read_files -.-> lab-123313{{"`Program to Find Size of Any File`"}}
end