Professional Documents
Culture Documents
3 - Les Fichiers en Langauge C
3 - Les Fichiers en Langauge C
Mr Benabderrezak
Introduction
• To create a file, you can use the w mode inside the fopen() function
• The w mode is used to write to a file. However, if the file does not exist, it will
create one
Write To File
Write To File
• As a result, when we open the file on our computer, it looks like this:
Append Content
Append Content
• As a result, when we open the file on our computer, it looks like this:
Read File
Note
• The fgets() function only reads the first line of the file.
• If you remember, there were two lines of text in filename.txt
• To read every line of the file, we use a while loop
Read File
Read File
Hello World!
Hi everybody!