Visual Studio C++ has many, many ways of reading and writing information from/to a disk file. A search in Wikipedia reveals about 50 different functions in several major categories. The topic can be daunting. Sometimes the task is simply to read a text file consisting of relatively short lines of human readable text. This can actually be accomplished using some simple, high level C++ Classes. Only a few lines of code are actually required. The main library function that we will use is named "ReadLine()" and we will use a simple ListBox to display the file on the screen. One issue that the novice often misses is the handling of errors or “exceptions”. For example, what if the filename is wrong or if there is a disk error?
A simple program will be used as a starting point for a discussion. The program creates a Windows Dialog box and then allows a text file to be viewed on a Windows screen. The program is called "File Demo" and a screen shot is shown below.
// FILEDEMO - A simple file read application with discussions
// on exception handling. B.Arnold 6/21/2011
// CLR - Windows Forms Application
Welcome to the CSIG, a Special Interest Group of the ACGNJ. This will be a "Members Night". Members are encouraged to bring in C++ questions, problems, and even programs to be discussed by the entire group. Additionally, we will have a review of topics covered during the last few months. Most of the programs previously presented used the latest C++ compiler in Microsoft's Visual Studio. There are a number of ways to refer to this compiler and code. Here's what Wikipedia says:
The Common Language Infrastructure (CLI) is an open specification developed by Microsoft that describes the executable code and runtime environment that form the core of the Microsoft .NET Framework. The specification defines an environment that allows multiple high-level languages to be used on different computer platforms without being rewritten for specific architectures.
|Microsoft .Net Framework 2.0, etc.|
|C++ 7.0, etc.|
|.Net 2.0, etc.|
|Common Language Infrastructure|
So bring in your Questions, Snippits and Programs for discussion.
Source Code FilesFor help, email me at b a r n o l d @ i e e e . o r g