 Hello friends, I am Sanjay Gupta. In this video, I am going to discuss with you about file handling in C and the topic is different modes to open a file in C programming. Before starting, you can note how you can search my YouTube channel. You can type my name Sanjay Gupta in YouTube search. My channel will be available there. You can watch various programming related videos there. Now I am going to discuss various modes to open a file in C programming. So first mode is R. So in this mode, it opens an existing file in read mode only. So existing means file must be available in your computer system. Then only it can be opened through R mode and in read mode only. If file is not present, then it does not create a new file. So if file is not available in your system, then R mode doesn't create a new file. It can open an existing file through a C program. Second mode is W. It opens a file in write mode. If file is not present, then a new file will be created automatically. So W mode automatically creates a file if a file doesn't available in your system. If file is already present, then its contents will be erased automatically. So if file is already available and if you are opening that file in W mode, then its previous contents will be erased automatically. So in case of W mode, previous contents will not be preserved. It will be erased automatically. Now if you want to preserve previous contents, then you can prefer A mode. So it opens a file in append mode. Append means addition at the end of file and if file is not present, then a new file will be created automatically. It also creates a new file if file is not available in your system. If file is already present, then its contents will be preserved. So in case of A mode, if your file is already present, then its previous contents will be preserved and you can add new contents also. So these are three modes R, W and A. Three more modes are available that are R+, W+, and A+. So now I am copying these statements and I am pasting them. So first is R, second is W, third one is A. Now fourth one will be R+, fifth one will be W+, and sixth one will be A+. So R+, it opens an existing file in read and write mode and if file is not present, then it does not create a new file. So R+, opens an existing file for both reading and writing operation, but it doesn't create new file if file is not present. Then W+, it opens a file in read and write mode. So you can perform both the operations with W+, and rest of the statements will be same as W. If file is not present, then a new file will be created automatically and if file is already present, then its contents will be erased automatically. And last one is A+, and A+, it opens a file in read and write mode. So both operations can be performed. If file is not present, then a new file will be created automatically. If file is already present, then its contents will be preserved and in case of A+, writing operations will be done at the end of file only. So this way I have discussed six modes through which you can open a file in C programming and all these six modes are available for file handling in C. So I hope you have understood how you can use a particular mode to open a file in C programming. If you want to watch more programming related videos, you can search my name Sanjay Gupta in YouTube search. My channel will be available there. You can watch various programming related videos there. Thank you for watching this video.