Page 1 of 1

include command with string variable

Posted: Wed Dec 18, 2019 3:35 pm
by Elderfield.A
Hi,

Can the include command be used with a string variable?

for example

Code: Select all

include  "C:\Some folder\some other folder\a_program.prg"
 


Works but

Code: Select all


string filepath =  "C:\Some folder\some other folder\a_program.prg"
include filepath


doesn't work if the file path isn't the same as the current working directory.

Thanks

Adam

Re: include command with string variable

Posted: Wed Dec 18, 2019 3:49 pm
by EViews Gareth
It cannot.

Includes are performed as a pre-processor step, and as such are done before any % or string variables are available.

You can use Exec instead, although that might not give you exactly what you want.

Re: include command with string variable

Posted: Wed Dec 18, 2019 4:21 pm
by Elderfield.A
No, I don't think exec will work unless I define my file paths as string variables?

In any case, thanks.