RosettaCodeData/Task/Take-notes-on-the-command-line/BBC-BASIC/take-notes-on-the-command-l...

30 lines
817 B
Plaintext

REM!Exefile C:\NOTES.EXE, encrypt, console
REM!Embed
LF = 10
SYS "GetStdHandle", -10 TO @hfile%(1)
SYS "GetStdHandle", -11 TO @hfile%(2)
SYS "SetConsoleMode", @hfile%(1), 0
*INPUT 13
*OUTPUT 14
ON ERROR PRINT REPORT$ : QUIT ERR
notes% = OPENUP(@dir$ + "NOTES.TXT")
IF notes% = 0 notes% = OPENOUT(@dir$ + "NOTES.TXT")
IF notes% = 0 PRINT "Cannot open or create NOTES.TXT" : QUIT 1
IF @cmd$ = "" THEN
WHILE NOT EOF#notes%
INPUT #notes%, text$
IF ASC(text$) = LF text$ = MID$(text$,2)
PRINT text$
ENDWHILE
ELSE
PTR#notes% = EXT#notes%
PRINT #notes%,TIME$ : BPUT#notes%,LF
PRINT #notes%,CHR$(9) + @cmd$ : BPUT#notes%,LF
ENDIF
CLOSE #notes%
QUIT