-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path33_file_io.c
39 lines (34 loc) · 2.16 KB
/
33_file_io.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#include <stdio.h>
int main(){
/*
-------------------- WHY DO WE NEED A FILE? --------------------
- Files are used to store data and information.
- Files are used to read & access data anytime from the hard disk.
- Files make it easy for a programmer to access and store content without losing it on program termination.
- When a program is terminated, the data stored in RAM(Random Access Memory) is lost.
- Storing data in a file will preserve our data even after the program terminates.
- RAM is not able to handle quite large amount of data due to small size relative to the hard disk.
- It is easy to transfer data as files.
-------------------- VOLATILE VS NON-VOLATILE MEMORY --------------------
Volatile Memory | Non-Volatile memory
- Volatile memory is a computer storage that only | - Non-volatile memory is a computer memory that can
maintains its data while the device is powered. | retain the stored information even when not
| powered.
- The RAM will holds data, programs, and information | - This type of memory is also referred to as
as long as it has a computer power supply but | permanent memory since data stored withint it can
immediately the power is interrupted all that | be retrieved even when there is no constant power
content is cleared. | supply.
- The Volatile memory will only hold data temporarily. | - It is used for long-term storage data.
-------------------- TYPES OF FILES --------------------
- There are two most common types of files for data storage:
- Text files
- Binary files
-------------------- FILE OPRATIONS IN C --------------------
- In C we can perform these high level operations on files:
1. Creating a new file
2. Opening a file.
3. Closing a file.
4. Reading from and Writing to a file.
*/
return 0;
}