SAVE Command

Purpose:

To save a program file on diskette.

Syntax:

SAVE filename,[,a]
SAVE filename,[,p]

Comments:

filename is a quoted string that follows the normal MS-DOS naming conventions. If filename already exists, the file will be written over. If the extension is omitted, .bas will be used.

The a option saves the file in ASCII format. Otherwise, GW-BASIC saves the file in a compressed binary format. ASCII format takes more space on the diskette, but some diskette access commands (for example, the MERGE command and some MS-DOS commands, such as TYPE) may require an ASCII format file.

The p option protects the file by saving it in an encoded binary format. When a protected file is later run or loaded, any attempt to list or edit it fails. When the p option is used, make an additional copy under another name or diskette to facilitate future program maintenance.

Examples:

The following command saves the file com2.bas in the ASCII format:

SAVE "COM2", A

The following command saves the file prog.bas in binary format, and protects access:

SAVE "PROG", P