Author Topic: $include  (Read 112 times)

krovit

  • Newbie
  • *
  • Posts: 25
$include
« on: May 16, 2018, 11:34:36 am »
Hi!
I would like to create a global variable containing the address of the program folder. I know, it's easy! What I would like, though, is to pass that variable to the $include command because some pieces of code are added by the user with a text editor.
I think it's not possible ... what can you tell me, is that so?

Thank you!


Petr

  • Hero Member
  • *****
  • Posts: 682
Re: $include
« Reply #1 on: May 16, 2018, 12:59:23 pm »
Hi.

I do not understand exactly what you mean. As part of the code is opened in another text editor, is added to the main program via $INCLUDE so that it has information about where the main program is? Send the variable from the main program: DIM SHARED ADRESS$: ADRESS$ = _CWD$, the attached file will see this variable.

When doing so, beware of one ugly feature. When you change the contents of the file you added using $INCLUDE , in the main program, in the IDE, first press a key and then recompile it to the new EXE. If you pressing nothing in IDE before compiling, old content is add. Maybe its repaired in new versions, but i don t know if is or not.

It is also possible that the compilation will not start or end with error, until you close the external content editor for $INCLUDE source.

For sharing this between two sundry programs but use COMMON SHARED.
Coding is relax.

krovit

  • Newbie
  • *
  • Posts: 25
Re: $include
« Reply #2 on: May 17, 2018, 11:30:21 pm »
Hi Petr,

thanks, it's me that I did not remember the operation of the $include command: for this you did not understand!

About the malfunction for which you need to press a button... I had noticed (it's weird but it should not be difficult to make up for those who wrote QB64).

I will use the _CWD $ function.

A function similar to $include would be useful in order to include a piece of code that is different each time and compiled with the source. Would allow, for example, to write apart - in a TXT file - something to be interpreted to the code without having to open it every time and without having to load it with OPEN.