home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Shareware Overload
/
ShartewareOverload.cdr
/
progm
/
tptools.zip
/
BINED.ZIP
/
SIMPLE.PAS
< prev
Wrap
Pascal/Delphi Source File
|
1987-12-21
|
1KB
|
31 lines
{ SIMPLE.PAS
Copyright (c) 1985, 87 by Borland International, Inc. }
program Simple; {SIMPLE.PAS: A simple editor using the BINED unit}
uses BinEd, Crt;
const ExitCommands : Char = #0; {No extra exit commands}
var EdData : EdCB; {Editor control block}
procedure Abort(Msg : String);
begin {Abort}
GotoXY(1, 25); Write(Msg); Halt(1);
end; {Abort}
begin
if (ParamCount = 0) then {No filename}
Abort('Usage: SIMPLE filename.ext');
if (InitBinaryEditor(EdData, MaxFileSize, 1, 1, 80, 25, {Initialize a window}
True, EdOptInsert, '', ExitCommands, nil) <> 0) then{Couldn't load editor}
Abort('Unable to load binary editor.');
if (ReadFileBinaryEditor(EdData, ParamStr(1)) > 1) then {Couldn't read file}
Abort('Unable to read ' + ParamStr(1));
ResetBinaryEditor(EdData); {Reset for new file}
if (UseBinaryEditor(EdData, '') = -1) then {Edit the file}
if ModifiedFileBinaryEditor(EdData) then {Was it modified?}
if (SaveFileBinaryEditor(EdData, True) <> 0) then {Save it}
Abort('Error saving file.');
GotoXY(1,25);
end.