<< Chapter < Page Chapter >> Page >

Download from Connexions: Monitor_Testing_Shell.cpp

Download from Connexions: udst_monitor.h

Download from Connexions: udst_monitor_prototypes.txt

Download from Connexions: Monitor_Verify_Header.cpp

Study the files collectively to understand the concepts

Take a few moments to review the files in conjunction with the concept discussion above. You should compile and run the Monitor_Testing_Shell.cpp program.

Creating a folder or sub-folder for your user library

Depending on your compiler/IDE, you should decide where to create a folder that will hold the header files you create. We suggest that you create the folder in conjunction with the compiler/IDE software. If you were using the Bloodshed Dev-C++ 5 compiler/IDE you most likely installed the compiler/IDE software at: C:\Dev-Cpp\ if you installed it on your machine or at: DriveLetter:\Dev-Cpp\ (where the DriveLetter is the drive that represents your flash drive) if you installed it on a flash drive. We suggest that you create a sub-folder at that location named:

  • user_library

The path of: C:\Dev-Cpp\user_library would be created as the location for your user library if using your machine installation. You can literally place it anywhere and name the library any name, but once you decide on a place and name; you do not want to move or rename the folders.

Placing the header file into the user library

You need to copy the udst_monitor.h file placing it into the user_library folder just created. As you can guess the udst stands for user defined specific task. The functions within this header file would be used to control the interaction a user has with the monitor. The .h is a convention of the C++ programming language and indicates a header file. Thus the identifier name for the header file is very meaningful and descriptive.

Verify that the header file works properly

Review the Monitor_Verify_Header.cpp source code file and note the two include commands are different.

  1. The Standard Library uses a less than and a greater than to bracket the Standard Library name of: iostream
  2. The user library uses quote marks to bracket the location of the header file. This identifies to the complier that we are specifying the exact file we want. We provide a complete file specification (drive, path information, filename and extension).
  3. Because this item is technically a string within C++, we must use two back slashes between the drive, path(s) and filename. This is because the first back slash assumes that the next character is an escape code and if we really don't want an escape code but a back slash, the second back slash says no I wanted a back slash.This string: "C:\\Dev-Cpp\\user_library\\udst_monitor.h" will be interpreted to mean: C:\Dev-Cpp\user_library\udst_monitor.h

Depending on what drive you are using, what path folder structure you are using and what you called your folder; you may need to correct the include reference within the source code so that it properly references the header file.

Compile and run the Monitor_Verify_Header.cpp program. Note: It should work exactly as the Monitor_Testing_Shell.cpp program.

Definitions

udst
User Defined Specific Task
testing shell
A program used to create specific task functions.
header file
A file that contains items we want to have included toward the top of our source code.

Get Jobilize Job Search Mobile App in your pocket Now!

Get it on Google Play Download on the App Store Now




Source:  OpenStax, Programming fundamentals - a modular structured approach using c++. OpenStax CNX. Jan 10, 2013 Download for free at http://cnx.org/content/col10621/1.22
Google Play and the Google Play logo are trademarks of Google Inc.

Notification Switch

Would you like to follow the 'Programming fundamentals - a modular structured approach using c++' conversation and receive update notifications?

Ask