[fpc-pascal]How to define a string const with content of a file?

Tom Verhoeff wstomv at win.tue.nl
Sat Sep 21 22:32:53 CEST 2002


I currently have the following line in a number of related programs:

	const TASK = '...'; { name of task }

where ... is replaced by the name of the task.

To simplify my life, I would like the ... to be taken from
a file named TASKNAME.  In shell scripts, I do it like

	TASK = `cat TASKNAME`

In make files, I do

	TASK = $(shell cat TASKNAME)

How can I do it in FreePascal?

Note that this file TASKNAME just has the name in it, no quotes etc.
Thus, {$INCLUDE TASKNAME} will not work.

Apparently, I need a mechanism related to {$INCLUDE %...%}, but
then for the content of a file, rather than the date or so.

Thanks for your suggestions,

	Tom Verhoeff




More information about the fpc-pascal mailing list