Open the Visual Studio software and the C project you want to edit. Double-click the code file to load the file in the editor.
The Visual C software development language lets you read any external file one line at a time. You use this Visual C method to read variables located in a system or program file. The information is stored in a string variable, and you can either store the information in a database or display the information on the Windows form.
Define the file you want to import. You import the file into a "StreamReader" variable, which contains the file's information, so you can read it line by line. Add the following code to your functions:
System.IO.StreamReader file = new System.IO.StreamReader("c:\\myfile.txt");
Replace "myfile.txt" with your own file name.
Read one line from the file. The following code reads the first line from the file:
data = file.ReadLine();
Display the information to the reader. The following code shows the information from the file to the reader: