Opening and Closing Source Files

·To create a new source file:

1.Choose New from the File menu.

2.Type your program name in the new window.

New files are labeled UNTITLED x until they are saved. The x is a sequential
number.

NOTE:

Before you can save or close a window it must be active. To activate a window either click the window or select the window name or number from the Window menu.

·To save a source file:

1.Activate the source window.

2.From the File menu, choose Save.

3.If your file is unnamed, the Development Environment displays the Save As dialog box (see Figure 2.1). Enter the file's name. If you are using the sample DOS program, name the file FIRST.

4.Select the drive and the directory to save the file to by choosing items from the Drives and Directories list boxes.

5.Choose OK.

If the file has already been named, the Save command saves any changes without displaying the Save As dialog box.

The title bar will display an asterisk (*) when the source file has been modified.

·To save a source file under a different name:

1.Activate the source window.

2.From the File menu, choose Save As.

3.Type a new name for the file.

4.Choose OK.

This is useful for maintaining revised copies of a source file while keeping the original unchanged. You can also use the Save As command to name and save a newly created file.

·To save all open source files that are new or have been changed:

Choose Save All from the File menu.

·To set save options:

The Environment command in the Options menu has two options that relate to saving files. To use the options:

1.From the Options menu, choose Environment. The Environment dialog box appears (see Figure 2.2).

2.Select Save Before Build to automatically save source files before an application is built.

3.Select Prompt Before Saving Files for the Development Environment to ask whether the file should be saved before being built.

4.Choose OK.

·To close a source file:

1.Activate the source window.

2.From the File menu, choose Close.

Or double-click the document Control-menu box.

Or press CTRL+F4.

If you are using the sample program, use one of these techniques to close the FIRST source window.

If you create a new source file and try to close it before saving, a message appears asking if you want to save the changes before closing.

·To activate a source file:

1.Click the title bar.

2.Select it from the Window menu.

3.Use the shortcut key listed on the title bar (ALT+#).

4.Use CTRL+F6 to cycle through all active windows.

·To open a source file:

1.From the File menu, choose Open.

2.Select the drive and directory where the file is stored. The default is the current drive and directory.

3.Set the types of files to display in the List Files of Type box. This box serves as a filter in displaying files to open. For example, C Source (*.C) displays all files with the .C extension. The drop-down box lists commonly used file extensions.

4.Choose OK to see a list of files in the selected directory.

5.Select the file from the list or type its name in the File Name box. If you are using the sample program, select the file named FIRST.

6.Choose OK.

The last four files that you opened and then closed appear in a list at the bottom of the File menu. You can open one of these files by choosing its name from the list.

Because the editor works with any ASCII file, you can open and edit text files created with other editors.

When a source file is opened, its name is added to the Window menu. If you want to see more than one view of your source file, use the New Window command on the Window menu to open another view. Do not use the Open command on the File menu to view the same source file. A file can be opened only once. You can, however, open multiple windows showing the same source file, so that you can, for instance, compare two different sections of the file. If more than one copy of the file is displayed, the window is titled filename:x, where x is a unique window number.

If no file extension is given, the Development Environment will automatically add a .C extension to the filename.