ZFGC
Resources => Coding => Topic started by: PoeFacedKilla on May 29, 2007, 03:28:26 am
-
Is it possible to load code from a .txt file? like if i put cout<<"This is From a File";
it would show that in the program?
-
No. At least not without having to create your own parser.
-
No, thats a features reserved only for scripting languages. With pre-compiled code its next to impossible.
-
You could compile the external source code (in the .txt file for this example) on run time and then load it dynamically. Although that means the user of your program needs to have a compiler installed. And now we are talking about really advanced stuff.
Or, if your .txt-files would only need a limited sets of functions and not too much code (we are not talking about real-time code here, do we?) you can easily make some kind of simple naive parser (e.g. line-by-line each argument separated by space, first argument function-name) for it without that much knowledge on how to write an optimized one.