1.4 basic operations of Turbo C

Source: Internet
Author: User

1.4.1Run a C LanguageProgramGeneral Process

Turbo C is an integrated software environment integrating source program editing, compilation, connection, operation and debugging, and using menu drivers.

The general process of running a C Language Program:

(1) Start TC to enter the TC integration environment.

(2) edit (or modify) the source program.

(3) compile. If the compilation is successful, you can perform the next step. Otherwise, (2) modify the source program and re-compile until the compilation is successful.

(4) connection. If the connection is successful, you can proceed to the next step. Otherwise, modify the settings based on the system error message and reconnect until the connection is successful.

(5) run. Check the program running result to verify the correctness of the program. If a logic error occurs, you must return (2) modify the source program and re-compile, connect, and run it until the program is correct.

(6) Exit the TC integration environment and end the program running.

1.4.2 TCStartup, exit, and command menu

(1) Start Turbo C: TC commandid

After Turbo C is started, its main menu bar is arranged horizontally at the top of the screen and activated. The main file item becomes the current item.

Under the main menu, the edit and message windows are displayed. In the two windows, the top horizontal line is displayed in double lines, indicating that the window is an active window.

 

The top of the editing window is the status line, where:

. Line 1 col 1: displays the row number and column number of the cursor, that is, the cursor position.

. Insert: indicates that the editing status is "inserted ". This field is blank when it is in the "Rewrite" status.

. D: noname. C: displays the currently edited file name. If "noname. c" is displayed, it indicates that the file has not been named by the user.

 

At the bottom of the screen is a description of the seven function keys and the Num Lock key status (when "num" is displayed, it indicates that it is in the "number key" status; when it is blank, it indicates the "control key" status ).

(2) Use of command menus

1Press the function key F10 to activate the main menu. If the main menu has been activated, go to the next step.

2Use the left and right arrow keys to move the optical band and locate it on the required main item. then press the Enter key to open its sub-menu (vertically arranged ).

3) Move the optical band with the arrow keys, locate the child item, and press Enter. After the selected function is executed, the system automatically closes the menu.

Note:: After the menu is activated, it is not used. You can press F10/ESC to close the menu and return the original status.

(3) Quit Turbo C

There are two methods to exit TC:

1) Menu method: file | quit (select the file primary item first, and then select and execute the quit subitem)

2) Shortcut key: Alt + "X" (Press and hold the Alt key, then press the Alt key X, and then release it at the same time)

1.4.3Edit and save a C language source program

(1)Activate the main menu, select and execute file | load (shortcut key: F3 ).

(2)In the "Load file name" window, enter the source program file name.

There are two ways to enter a file name: directly input and select input.

1) Input directly

A string consisting of file names can be entered one by one.

If an existing file exists, the system displays the file content in the editing window for editing and modification. If it is a new file, a blank editing window is provided for you to enter a new source program.

If the file is not in the current directory, you must name it with the path name and (or) drive letter.

2) Select a file (only applicable to existing source program files)

① Press enter to open the file names of all files in the current directory with the suffix. C.

② Use the top, bottom, left, and right arrow keys to position the light band on the required file name.

③ Press Enter.

(3) common editing operations

During the source program editing process, you can press the F2 key (or file | save) at any time to save the currently edited file and then edit it. This is a good habit!

Online help:

In any window (or status), Press F1 to activate online help for the activity window (or status:

. Next page -- Pagedown, return to previous page -- Pageup

. Close online help and return to the original window (or status) ── ESC

. Return to the previous online help screen-Alt + F1 (whether online help is activated or not)

. Back to online help index-F1: After activating online help and then pressing F1, the online help index is returned to query online help information of other categories.

. Query online help information of library functions-^ F1: move the cursor to the first character of the function name to be queried, and then type ^ F1 to obtain online help information of the library function.

Note: To simplify the description, use "^" to represent the "Ctrl" key. ^ FN is Ctrl + FN, the same below.

 

1.4.4Compilation and connection-a single source program file

Select and execute the compile | make EXE file item (shortcut: F9). Then, TC will automatically compile and connect the source program file being edited and generate an executable file.

If the source program has a syntax error, the system will prompt "error: press any key" at the bottom of the "Compiling" window in the center of the screen (error: press any key ).

Press the Space key to activate the message window at the lower end of the screen. An error (or warning) message is displayed, and the light is paused on the first message. In this case, the "edit" window also has a optical band, which always stops at compilation errorsSource code.

Note:: When the optical band in the message window is moved by the upper and lower keys, the optical band in the editing window also moves, always tracking the sourceCodeError location in!

1.4.5Run and view results

(1) run the source program file currently being edited

Select and run | run (shortcut: ^ F9). After the program is running, return to the editing window.

When you think that your source program will not have compilation or connection errors, you can also run it directly (that is, skip the compilation and connection steps of the source program ). At this time, TC completes the entire process from compilation and connection to running.

(2) view the running result

Select and execute run | user screen (shortcut: Alt + F5 ). After viewing the information, return to the editing window with one click.

If a logic error is found, you can modify it after returning to the editing window. Then, re-compile, connect, and run it until it is correct.

1.4.6Edit the next source program

Select and execute file | new.

If the following confirmation information is displayed:

Noname. C not saved. Save?(Y/N)

If you want to save the currently edited source program, type "Y" to go to the next step. Otherwise, type "N" (do not save) and jump to (2 ).

(1) The system prompts you to change the name:

<D:> <path> "noname. c

Enter the name you gave to the source program file.

(2) The system provides a blank editing window to start editing the next source program.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.