Coronado Enterprises Turbo C TUTOR July 1, 1987 COMPILER.DOC file This tutorial is written specifically for the Turbo-C compiler by Borland International. It is written for the first release of that particular compiler, and many of the topics discussed refer to the User's Guide and Reference Guide for that particular release. For that reason, when Borland releases a new version, some of the page numbers may be in error for the new release, but the topics will still be useable and valid. It is written to teach you how to read and write Turbo C programs but even more important, it is intended to teach you the vocabulary of the C language so that you can intelligently read the literature about C. Due to the ease of use of the Integrated Environment version of Turbo C, It will be used exclusively by this tutorial. You can use the Command Line version of Turbo C with this tutorial, but all notes in the tutorial will describe use of the Integrated Environment version. ******** Note - Note - Note - Note - Note - Note - Note ********* All of the files in the Coronado Enterprises Turbo C tutorial are designed to work with the Turbo C compiler with all options left in the default mode (ie - the way the compiler comes from the factory), and any changes may affect the way some of the example programs work. For example, if you were to change the number of significant characters used for an identifier to 4, the program named SCOPE.C in chapter 5, would have all 3 functions named the same, namely "head", and the program would not work. You would actually have other problems with this change, but they will not be commented on here. Other kinds of errors are also possible, so it would be best that you simply use the Borland defaults for the duration of the tutorial and when you have gained experience with C, customize your compiler to suit your own taste. ****************** Suggested Hard Disk Setup ********************* The Turbo C User's Guide has complete instructions describing how to set up your system for proper use. Following the direc- tions given will result in the following directory setup if you are using a hard disk. Some of the files have been omitted in this suggested setup to reduce the clutter in the TURBOC directory. This will reduce the confusion over extra files as you work your way through the tutorials. Turbo C disk 1 - INTEGRATED DEVELOPMENT ENV. Turbo C disk 2 - COMMAND LINE/UTILITIES Turbo C disk 3 - HEADER FILES/LIBRARIES/EXAMPLES Turbo C disk 4 - LIBRARIES/EXAMPLES C:\TURBOC\ TC.EXE /* From Turbo C disk 1 */ TCCONFIG.TC /* You make this file - See below */ TCHELP.TCH /* From Turbo C disk 1 */ *.* /* From Turbo C Tutor SOURCE disk */ C:\TURBOC\INCLUDE\ *.H /* From Turbo C disk 3 */ C:\TURBOC\INCLUDE\SYS\ STAT.H /* From Turbo C disk 3 \SYS\ subdir.*/ C:\TURBOC\LIB\ *.OBJ /* From Turbo C disk 3 */ *.LIB /* From Turbo C disk 3 */ *.OBJ /* From Turbo C disk 4 - optional */ *.LIB /* From Turbo C disk 4 - optional */ The *.OBJ and *.LIB files from disk 4 are needed only if you wish to use additional memory models. You only need the "Small" memory model to run all of the programs included in the Coronado Enter- prises Turbo C tutorial. After creating the subdirectories listed above and loading them with the files listed, change to the TURBOC directory and create the TCCONFIG.TC file by following these instructions (note that the instructions are given on page 16 of the Turbo C User's guide but they are somewhat cryptic for the beginner). 1. TC This loads the TURBO-C compiler 2. O Selects "Options" 3. E Selects "Environment" 4. I Selects "Include directories" 5. \TURBOC\INCLUDE Sets directory for include files 6. L Selects "Library directory" 7. \TURBOC\LIB Sets directory for library files 8. Returns to "Options" menu 9. S Selects "Store options" 10. Stores file named "TCCONFIG.TC" 11. Return to the TURBO-C main menu To run your first program. (This assumes FIRSTEX.C has been copied into the \TURBOC\ directory from the tutorial SOURCE disk.) 1. TC Loads the Turbo C compiler 2. F Selects "Files" 3. L Selects "Load" 4. Lists all files *.C 5. Position cursor on FIRSTEX.C 6. Loads FIRSTEX.C 7. Alt-R Compiles and runs FIRSTEX