Skip to content

Instantly share code, notes, and snippets.

@lievencardoen
lievencardoen / WriteToStandardOutput.p
Created February 2, 2023 10:54
Write to standard output on Windows and Linux
/**
* Have a procedure print Hello World on the Command Line.
*
* On Windows: prowin -b -p OutputToCommand.p | tee
* On Unix (DLC needs to be set): _progres -b -p OutputToCommand.p | tee
*
* tee is a command in command-line interpreters using standard streams which
* reads standard input and writes it to both standard output and one or more
* files, effectively duplicating its input. It is primarily used in conjunction
* with pipes and filters.
@lievencardoen
lievencardoen / read_contents_file_last_line
Created February 6, 2023 16:05
Read contents of a file. Will read the last line into ContentsFile.
DEFINE VARIABLE ContentsFile AS CHARACTER NO-UNDO.
INPUT FROM VALUE(SESSION:TEMP-DIRECTORY + "/test.txt":U).
DO WHILE TRUE ON ENDKEY UNDO, LEAVE:
IMPORT UNFORMATTED ContentsFile.
END.
INPUT CLOSE.
@lievencardoen
lievencardoen / read_contents_file_into_memptr
Created February 6, 2023 16:07
Read full content file into a memptr
DEFINE VARIABLE text-memptr AS MEMPTR NO-UNDO.
COPY-LOB FROM FILE "build.properties":U TO text-memptr.
MESSAGE GET-STRING(text-memptr, 1)
VIEW-AS ALERT-BOX.