C2. C Language in Turbo 'C' Editor & Unix

Turbo ‘C’ Editor

Open the Turbo ‘C’ Environment by double clicking the Turbo ‘C’ Short cut on the desktop if you are not clear then contact your Lab Coordinator, it’s very easy and is a Two Seconds Job for beginner .Usually it opens with a new file associated with a default name as
'Noname0000.c’. The Key Board Short Cut is ALT -->F -->N.
Now since your environment is ready you can start typing your program in the editor using the syntactical standards of ‘C’ Language.

Saving the Typed Program
The typed programs reside in your editor buffers temporarily until you do not issue save commend explicitly hence use the combination ALT -->F-->S from key board (OR) press F2 function key. If you are saving your source file for the first time then the save dialog box is displayed.
1. In the save dialog box, create your Personal folder in the required drive.
2. Select and open the created folder.
3. Name the file with a proper Primary Name and .C or .CPP extension as per your convenience.
4. Press OK Button or Press Enter Key
For continuous Saving of the updated program Press F2 function key.

Loading an existing program
Once the Program is saved and if the environment is closed then if the same program has to be reloaded once again then it should be reloaded properly form the location where it has been stored properly during the Save Process. Use the following combination from the keyboard ALT -->F -->L (OR) Press F3 function key.

Compiling the program
The programs that have been written by you are in a format that cannot be understood by the underlying computers architecture, hence it has to be converted to a form that is accepted by the 
Systems Architecture for this  COMPILATION Process is executed using ALT -->C key combination. Any Syntactical Errors that exist in the source file are listed in this step itself which have to be corrected, then only the Running and Linking process can be activated. This process includes all the LIBRARY FILES included or specified in the source code and SUBSTITUTES any DEFINITIONS that are detected or declared by the programmer.
This process creates an OBJECT FILE with .OBJ extention and marks linking process to start. 

Running the program

The program which is in the compiled state should be Run and Loaded for cross checking the expected results. This step is associated only when the following short cut is executed ALT -->R. This process calls the LINKER and associates all the memory declaration which are allocated, initialized and finalizes the OBJECT FILE to get converted to EXECUTABLE FILE, having .exe extension.

Compiling and Running the program
The above two steps of Compiling and Running can be completed at a time by using the following Keyboard Short Cut CTRL -->F9. This process activates both compilation process and running process one after the other sequentially, to produce executable file, which is the final stage in program process for any module. This file can be independently loaded by calling the name of the file.

Types of Resource Files Generated by the ‘C’ Program
SOURCE FILE .C (OR) .CPP Extension.
EXECUTABLE FILES .EXE (Runnable or Executable File).
BACKUP FILES .BAK (Compiler Specific).
Unix Environment
Creating a new program
Any normal TEXT EDITOR can be used.
The common text editor is vi (visual Editor) editor.
To create a file type vi filename.c at the UNIX Prompt.
If the file exits it is opened in the editor.
Creates the new file and the opens the file.
Compiling & Linking
The compiler used in UNIX is CC Compiler, the process of compilation is to come out of the vi editor environment and type CC Program.c at the UNIX prompt. If compiled properly an OBJECT FILE is created and id stored in the current working directory of the User.
The executable part of the program is pushed into a temporary buffer called as a.out file.

No comments: