include command with string variable

For questions regarding programming in the EViews programming language.

Moderators: EViews Gareth, EViews Jason, EViews Moderator, EViews Matt

Elderfield.A
Posts: 78
Joined: Thu Jul 11, 2019 10:47 pm

include command with string variable

Postby Elderfield.A » Wed Dec 18, 2019 3:35 pm

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

EViews Gareth
Fe ddaethom, fe welon, fe amcangyfrifon
Posts: 13307
Joined: Tue Sep 16, 2008 5:38 pm

Re: include command with string variable

Postby EViews Gareth » Wed Dec 18, 2019 3:49 pm

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.
Follow us on Twitter @IHSEViews

Elderfield.A
Posts: 78
Joined: Thu Jul 11, 2019 10:47 pm

Re: include command with string variable

Postby Elderfield.A » Wed Dec 18, 2019 4:21 pm

No, I don't think exec will work unless I define my file paths as string variables?

In any case, thanks.


Return to “Programming”

Who is online

Users browsing this forum: No registered users and 32 guests