kvarnerexpress 0 Report post Posted September 24, 2005 I have written two programs. Lets call them MAIN and SMALL . Program SMALL is supposed to eventually go inside program MAIN. Problem is that if I put the code inside of it, it will be extremely hard to read. Can I just compile the program and run it from inside the main one ? I've heard that you could. Both programs use identical variables and I wrote it this way intending to cut and paste the code into the main one but if I can do this without cutting and pasting 150 KB worth of source code then I'd like to learn how. I'm coding in C++ and am using functions and pointers but I haven't learned classes or templates yet. The code from program SMALL is too big to make a function I think. What do you think I should do ?kvarnerexpress Share this post Link to post Share on other sites
switch 0 Report post Posted September 25, 2005 normally i'd stick it in a class or possibly a namespace (which is similar to a class). classes aren't too hard to get the hang of, there's heaps of free tutorials on the net about c++ classes. try functionX c++ tutorials @ http://www.functionx.com/cpp/index.htm. the link to the 'User-Defined Types and Classes' tutorial is in the column on the left under 'C++ objects'.also you could probably do something like that with a DLL file, although i'm not too familar with them. i'm pretty sure that if you were to do it with a DLL, you would need to pass each variable as a seperate argument to the DLL or something like that.overall i think using a class is your best option. it's also a fundamental part of the C++ language, so learning it will probably boost your skill / productivity / creativity a considerable amount.ok good luck! Share this post Link to post Share on other sites
sobhan 0 Report post Posted October 2, 2005 I am not shure how to run program in c++ or VB, but in GML, this action is called 'execution'. In GML, you can execute program with one command: shell_execute ('filename'); Share this post Link to post Share on other sites
switch 0 Report post Posted October 4, 2005 actually, there's probably a windows shell function call that could do that. to find it, you'd probably want to check out the MSDN documentation in the win32 section. if you have to use MFC or anything it would probably introduce alot of needless overhead, so try to avoid it.cheers (by the way thanks for that sobhan, you've helped me with that post too ) Share this post Link to post Share on other sites
sharpz 0 Report post Posted November 16, 2005 one program cannot access the other programs variables (without accessing the memory directly) , but you could run the SMALL program by calling " System("SMALL.exe -param -param2 -param3"); but you would need to include <windows.h> to use the System() function. a better method would be to put the code from SMALL into a .cpp file and if you are using visual studio, if you include it in the workspace it will be compiled with the program. Share this post Link to post Share on other sites