Introduction
The process for any B2C program is simple: Edit, Compile, Download, Run, and Repeat. In this chapter we'll look at the first part: Editing.
There are many good editors for use on the PC. Every programmer has a favorite editor. Here, we will discuss the Notepad editor for Windows, and the Edit program for MS-DOS. You will also be introduced to the MS-DOS Command Prompt, since you will spend much of your time there.
Notepad
The Notepad editor is a bare-essentials editor, which is precisely what we need for editing B2C programs. You can run Notepad by selecting the "Start" menu and pulling-right on "Accessories". Pull-down to the "Notepad" icon. Here is a summary of the Notepad menu options:
Menu Option |
Keyboard Equivalent |
Comments |
File->New | Alt-F-N | Create a new, empty, text file |
File->Open | Alt-F-O | Open an existing file |
File->Save | Alt-F-S | Save the current file |
File->Save As | Alt-F-A | Save the current file with another name |
File->Page Setup | Alt-F-T | Print out setup |
File->Print | Alt-F-P | Print the file |
File->Exit | Alt-F-X | Exit Notepad |
Edit->Undo | Ctrl-Z | Undo edits |
Edit->Cut | Ctrl-X | Cut current selection |
Edit->Copy | Ctrl-C | Copy current selection |
Edit->Paste | Ctrl-V | Paste buffer |
Edit->Select All | Alt-E-S | Select entire file |
Edit->Time/Date | F5 | Insert Current Time/Date into file |
Edit->Word Wrap | Alt-E-W | Wrap words at the end of the line (or let lines go offscreen) |
Edit->Set Font | Alt-E-F | Set the font (default : courier) |
Search->Find | Alt-S-F | Find text |
Search->Find Next | F3 | Find text again |
Search->Replace | Alt-S-R | replace text (only on Windows NT) |
Help->Help Topics | Alt-H-H | Help information on Notepad |
Help->About | Alt-H-A | Copyright information |
Run Notepad and type the following
print "hello world" dim b as int input b
Now exit the Notepad selecting the File->Exit menu and answer "Yes" when it asks you if you want to save the file. Use the filename "hello.b2c".
MS-DOS and Edit
The MS-DOS Edit command is a more powerful alternative to the Notepad
editor. It offers a more professional set of features than Notepad.
As a programmer, these features give you an easier path from your ideas to
your code. The faster you can type your ideas into the editor, the
more ideas you can code. So what features do we need in an editor?
Here is a list of the bare essentials:
You may desire other features, but I find these to be the minimum. Notepad (for Windows 9x) does not have a search & replace and line numbering.
MSDOS as Your Working Environment
The MS-DOS (Microsoft Disk Operating System) Prompt is still delivered with all MS Windows operating systems. This is a viable working environment for our needs.
DO THIS |
To run the MS DOS Command Prompt, select the Start menu and Programs. Pull right and find MS DOS Prompt (or Command Prompt) in the menu. |
You may want to modify some of the properties of the MS-DOS window. For example, the default setting is for a 24-line display. I like more lines of text when using the text editor. To change the properties, click the left mouse button over the MS-DOS logo in the upper-left corner of the window - this will display a menu. Select "Properties" at the bottom of the menu.
Here are the settings I like to use for MS-DOS:
Tab Selection |
Setting |
Default |
Recommended |
||
Program |
-keep all defaults- |
-keep all defaults- |
-keep all defaults- |
||
Font |
Bitmap Only |
Both Font Types |
Bitmap Only |
||
|
Font Size |
Auto |
8x12 |
||
Memory |
-keep all defaults- |
-all set to Auto- |
-keep all defaults- |
||
Screen |
Usage |
Window |
Window (not Full Screen) |
||
|
Initial Size |
Default |
50 lines |
||
|
Window |
Display Toolbar (checked) |
Do Not Display Toolbar |
||
|
|
Restore Settings (checked) |
Restore Settings (checked) |
||
|
Performance |
Fast ROM Emulation (checked) |
Fast ROM Emulation (checked) |
||
|
|
Dynamic Memory Allocation (checked) |
Dynamic Memory Allocation (checked) |
||
Misc |
-keep all defaults- |
-keep all defaults- |
-keep all defaults- |
MS-DOS Commands
There are relatively few MS-DOS commands that you will need to know in this tutorial. Fortunately, the majority of tasks can be handled in Windows. Nevertheless it is useful to know how to do certain, fundamental operations. The following table summarizes them:
Command |
Syntax |
Remarks |
|||
Del |
del filename.ext |
deletes one or more files (*=wildcard characters) |
|||
Copy |
copy file1.ext file2.ext |
copies file1 to file2 |
|||
Cd |
cd dirname |
change directory from one place to another |
|||
batch file |
filename.bat |
a list of MS-DOS commands in a file with the extension .bat. This will be executed when you type in the name of the file (like make.bat in Step1.app) |
|||
Dir |
dir |
- list all files in current directory |
Introducing MS-DOS Edit
DO THIS |
In the
MS-DOS Prompt, type
cd C:\ \B2Cv5 (where is the path to B2Cv5) |
DO THIS |
Next type "edit" and when the blue screen pops up, type in the following print "hello world" dim b as int input b Now exit the editor by typing the ALT-F-X commands (or choosing File->Exit with the mouse) and answer "Y" when it asks you if you want to save the file. Save the filename as "hello.b2c" |
MS-DOS Edit Commands
MS-DOS Edit is a very straightforward editor with a few hidden options. It is "mouse-enabled," meaning that if you click on the menu bar, the expected Windows-like thing will happen. Clicking on some text in the Editor window will move the cursor to that position. You can drag the mouse over text and it will select the text.
If you would rather, you can use the keyboard for menu operations by holding down the ALT key (at the bottom of the keyboard, next to the space bar). When you hold down the ALT key, the menu "lights up" and you may press the highlighted character to drop-down the selected menu. For example, selecting ALT-F drops-down the File menu. Also, holding down the SHIFT key and moving the arrow keys will select text for cut and paste operations.
In dialog boxes, the TAB key usually will move you from field to field. The arrow keys will move you up, down, left, and right. If you select text in the Editor window and hit the TAB key, the selected region will be indented one tab stop (usually 8 characters). Holding down the SHIFT key and hitting TAB will "outdent" one tab stop.
MS-DOS Edit Menu commands
Menu Option |
Keyboard Equivalent |
Comments |
File->New | Alt-F-N |
Create a new, empty, text file |
File->Open | Alt-F-O |
Open a file that has already been created |
File->Save | Alt-F-S |
Save the currently displayed file |
File->Save As | Alt-F-A |
Save the currently displayed file with another name |
File->Close | Alt-F-C |
Close the current file and its window |
File->Print | Alt-F-P |
Print the currently displayed file |
File->Exit | Alt-F-X |
Exit the Editor |
Edit->Cut | Ctrl-X |
Delete the currently selected text and copy it to the buffer |
Edit->Copy | Ctrl-C |
Copy the currently selected text to the buffer |
Edit->Paste | Ctrl-V |
Insert the buffer into the currently selected file |
Edit->Clear | Del |
Delete the currently selected text (but don't copy it to the buffer) |
Search->Find | Alt-S-F |
Open the Find Dialog Box and search for the first occurrence |
Search->Repeat Last Find | F3 |
Repeat the last find command |
Search->Replace | Alt-S-R |
Open the Search/Replace Dialog box |
View->Split Window | Ctrl-F6 |
Split the current window in two horizontally |
View->Size Window | Ctrl-F8 |
Begin resizing the split windows. Use the up and down arrow keys |
View->Close Window | Ctrl-F4 |
Close the currently selected split window, restore to a single window pane |
View->n | Alt-n |
where n=1-9 - make the selected file the currently selected file |
Options->Settings | Alt-O-S |
Display the Settings dialog box |
Options->Colors | Alt-O-C |
Display the Colors dialog box allowing you to customize the colors to your preferences |
Help->Commands | Alt-H-C |
Display a listing of keyboard commands |
Help->About | Alt-H-A |
Display copyright information |
The File->Open and File->Save As menu options will display a dialog box with ...
The File-Print menu option will give you the option of printing selected text or the entire file.
The Search->Find menu option will display a dialog box with ...
The Search->Replace menu option will display a dialog box with ...
The View->Split option splits the current window into 2 panes. You are free to open a second, different file into the second window. You may resize the panes by selecting View->Size Window and moving the "center bar" up and down with the arrow keys. Or, you can use the mouse pointer to grab the "center bar" and drag it to the size you like. Selecting View->Close Window will return the Editor to single-pane viewing.
The Options->Settings will display a dialog box with ...
The Help->Commands menu option displays a dialog box with a listing of many "hidden" keyboard commands. I won't repeat their descriptions here. Most of them are obvious (like Home to return to the beginning of a line). But there are a few surprises (like CTRL-Y to delete a line). Use the Page-Up and Page-Down keys to scroll through the list.
file: /Techref/cybiko/b2c/ch4.htm, 51KB, , updated: 2008/6/13 16:58, local time: 2024/11/21 20:13,
18.188.227.64:LOG IN
|
©2024 These pages are served without commercial sponsorship. (No popup ads, etc...).Bandwidth abuse increases hosting cost forcing sponsorship or shutdown. This server aggressively defends against automated copying for any reason including offline viewing, duplication, etc... Please respect this requirement and DO NOT RIP THIS SITE. Questions? <A HREF="http://ecomorder.com/techref/cybiko/b2c/ch4.htm"> cybiko b2c ch4</A> |
Did you find what you needed? |
Welcome to ecomorder.com! |
Welcome to ecomorder.com! |
.