 Welcome to this course on computer programming. In this session, we are going to look at how text data is handled from text files. From the video lectures, you would have seen how files are handled generally. We note that each file is stored on external storage devices. The files have a name, a path or a location, size and access permissions. All of these things are handled by the operating system. When we wish to handle files and data from files in C++ programs, we can define and use special pointers called file pointers. And the name of the pointer becomes the internal file name as far as C++ program is concerned. Of course, a file pointer has to be associated with an external file. What we will see in this session and the subsequent sections is how to handle data from text files. First and foremost, we know that text data can be independently entered in a text file using any text editor. There are several other file formats such as word processors, spreadsheets, etc. where the data is stored in some specialized format. But all of these programs permit the files to be saved as plain text files such as data from a spreadsheet. We shall later see how a spreadsheet data is saved as a text data and processed using C++ programs. As we mentioned, C++ programs can read data from and write data to text files. We note that the C in operator that we use can read a sequence of ASCII characters and can convert these characters into appropriate values in internal format. Similarly, C out converts internal values into ASCII characters text and outputs these on monitor. Actually, these operators read and write from files. These two standard files are called STD in and STD out to represent standard input file and standard output file. The normal input output operations are conducted by the operating system using STD in and STD out. These files are automatically opened by the operating system. More importantly, these are automatically connected to keyboard and terminal by the operating system. Let us look at this action of the operating system diagrammatically. When we execute our program, the operating system connects the file STD in to our program and similarly connects the STD out to our program. What the operating system does by default is that it connects the STD in to keyboard and STD out to monitor. That is how we are able to type in our input from keyboard read by the program and the output produced by the keyboard via STD out connected to monitor goes on to the monitor. In short, we note that when our program starts execution, the operating system connects STD in to keyboard and STD out to monitor and that is how we carry out our input output operations using keyboard and monitor. The default connections for STD in and STD out are automatically invoked even when we execute a program from a command line. For example, we say my prog at the command line. It will take input from keyboard and give output to the terminal. When we use code blocks to execute our program, for example, a terminal window is opened which is connected to a STD out and our keyboard is used by code blocks as STD in. It is possible to redirect the two standard files STD in and STD out to external text files stored for example on this. If we type at command line, my program less than infile.txt greater than outfile.txt. Now this command line means that do not read data from STD in but read from infile.txt. In short, STD in is now redirected to the file infile.txt. So all keyboard inputs such as by using CN will now be read from this file and not from keyboard. Similarly, greater than outfile.txt means that STD out is connected to outfile.txt. So all output such as that produced by using CN will now be returned to this file. Let us look at the redirection diagrammatically. When we issue a command myprog less than infile.txt greater than outfile.txt let us see what happens. Let us see how redirection works on the STD in and STD outfiles. As usual our program would be given two files STD in and STD out. However when we use redirection the STD in is collected to an input file and so is STD out. What it means is that the text input will now come from infile.txt and the text output will go out to outfile.txt. In short, this is how the redirection will be implemented. Our program which reads data from STD in will now instead read it from infile.txt and our program which produces output on STD out will actually write it to outfile.txt. In summary we saw that the normal text input and output actually comes from and goes to files. STD in and STD out are standard input output files used by any operating system. Normally these are connected to keyboard and terminal but can be redirected to other text files. Thank you.