Turbo 'C' Editor
Creating a NEW FILE/PROGRAM.
Open the Turbo 'C' Environment by double clicking the Turbo 'C' Short cut on the desk top 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.
In the save dialog box, create your Personal folder in the required drive.
Select and open the created folder.
Name the file with a proper Primary Name and .C or .CPP extension as per your convenience.
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.
In the File Open Dialog box, Select the required path where you saved your file previously and press OK button (OR) press Enter Key.
Compiling the program
The programs that have been written by you are in a format that cannot be understood by the underlying computers architechture, hence it has to be converted to a form that is accepted by the Systems Architech ture for this COMPILAT process is executed using ALTàC key combination. Any Syntactical Errors that exist in the source file are listed in this step it self 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
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.
Type a.out at the UNIX prompt.
The Modes in vi Editor
INPUT MODE: Used for inputting data in the vi Editor.
COMMAND MODE: Used to implement the Editor Commands that act upon the Editing Standards for the source code.
Ex MODE: In the ex mode commands can be executed in the last line of the editors screen to act upon text.
Type : w and press enter key (or)
Type : x and press enter key.
Before a C program is compiled, it is first edited by a preprocessor. Commands intended for the preprocessor are called directives.
This directive states that the information in
is to be “included” into the program before it
is compiled. contains information about C's standard I/O
library. C has a number oi headers like : each contains
information about some part of the standard library.
The reason we're including
is that C, unlike some programming languages, has no built-in “read”
and “write” commands. The ability to perform input and output is provided
instead by functions in the standard library.
Directives always begin with a # character, which distinguishes them from other items in a C program. By default, directives are one line long, there's no semicolon or other special marker at the end of a directive.