Streams are an essential part of any input-output library. You can use streams when your program needs to "read" or "write" data to an external data source such as files, other PCs, servers etc. It is important to say that the term input is associated with reading data, whereas the term output is associated with writing data.
As we mentioned earlier, we can divide the streams into two large groups according to the type of data that we deal with – binary streams and text streams.
Binary streams, as their name suggests, work with binary (raw) data. You probably guess that that makes them universal and they can be used to read information from all sorts of files (images, music and multimedia files, text files etc.). We will take a brief look over them, because we will currently focus on working with text files.
Text streams are very similar to binary, but only work with text data or rather a sequence of characters (char) and strings (string). Text streams are ideal for working with text files. On the other hand, this makes them unusable when working with any binaries.
Text files are very convenient for storing various types of information. For example, we can record the results of a program. We can use text files to make something like a journal (log) for the program. Here we use StreamWriter for input/write data.
Now, we have learned how to create StreamReader. We can go further by trying to do something more complicated: to read the entire text file line by line and print the read text on to the console. Our advice is to create the text file in the Debug folder of the project (.\bin\Debug), so that it will be in the same directory in which your compiled application will be and you will not have to set the full path to it when opening the file.
Currently we improved our website User Interface and other contents. Our next update is adding video tutorials on this site so, We create a new YouTube channel, our YouTube channel name is CodeX.
We need some time for make video tutorials (CodeX) so, stay with us and keep supporting and you know already we make a Collaboration with HackIsOn YouTube channel long time ago So, please Subscribe Our Channels