Computer Science Canada Calling on other programs |
Author: | Rocket [ Tue Jun 06, 2006 5:26 pm ] |
Post subject: | Calling on other programs |
Here what i would like to do i have program A A gives a choice to call on program B , C, and D when B, C, or D is finished it will again call on A Is it possible to have program B,C and D as seperate t files but have prgram a load them and display them in the same run window if yes how do i do this |
Author: | Cervantes [ Tue Jun 06, 2006 6:23 pm ] |
Post subject: | |
Check out "include". |
Author: | bluedevils_77 [ Tue Jun 06, 2006 7:38 pm ] |
Post subject: | |
its called importing and exporting in program B,C,D hvae unit export (name) hello procedure(name) hello end (name) hello if name was hello then in program A hvae import "hello.tu" then when want it to run (program name , what u save it as).hello |
Author: | HellblazerX [ Tue Jun 06, 2006 8:30 pm ] |
Post subject: | |
I've never gotten into classes in Turing, but if I'm not mistaken, import and export is generally for classes right? I think Rocket just wants general programs or code, so include would be the method for him. |
Author: | Rocket [ Tue Jun 06, 2006 9:25 pm ] |
Post subject: | |
no blue devil did what i want i think, plus if i use units, im gonna get super marks! thanks dude |
Author: | TheOneTrueGod [ Tue Jun 06, 2006 9:29 pm ] |
Post subject: | |
I think what bluedevils_77 said will only work in one file. If you have two different .t files, you're going to need to include them... It doesn't matter if the other file is a unit or not. |
Author: | Rocket [ Tue Jun 06, 2006 9:32 pm ] |
Post subject: | |
sorry for the double post but i cant find an edit button... #1 from program B, C, D how would i call on A again. #2 if i have varibales in B,C,D will my code still run if they are declared in B,C, D |
Author: | Clayton [ Tue Jun 06, 2006 9:47 pm ] |
Post subject: | |
ok lets get this straight : units are generally modules,not classes, modules are only a collection of procedures, functions, and processes and nothing else, so for your purposes i believe you wish to include your programs, not units |
Author: | bluedevils_77 [ Wed Jun 07, 2006 7:57 pm ] |
Post subject: | |
first of all whats an include and second u can import many other .tu files in other turing programs |
Author: | Clayton [ Wed Jun 07, 2006 8:01 pm ] | ||
Post subject: | |||
include is a command that looks for the program name specified after it and basically copies and pastes it into that part of your code ex. (assume we have a program called test.t in the folder with this)
that simple |
Author: | bluedevils_77 [ Wed Jun 07, 2006 8:04 pm ] |
Post subject: | |
first of all whats an include and second u can import many other .tu files in other turing programs |
Author: | Clayton [ Wed Jun 07, 2006 8:19 pm ] |
Post subject: | |
why did you post the exact same thing an hour after you posted the first one? did you even read my post? look through the Turing Walkthrough and read through it, you might learn something on the way |
Author: | Rocket [ Wed Jun 07, 2006 9:44 pm ] | ||||
Post subject: | |||||
well from the above posts it sounds like include will work, but howif i ahve it in a procedure would it go like this
and this will all stay in te same window |
Author: | Clayton [ Wed Jun 07, 2006 10:02 pm ] |
Post subject: | |
thats exactly how it would work, because like i said, include basically just copies the file in question and pastes it into the program you have running |
Author: | Rocket [ Thu Jun 08, 2006 2:02 pm ] |
Post subject: | |
and then if a was called again the varables wouldn't be screwed up? |
Author: | Clayton [ Thu Jun 08, 2006 3:29 pm ] |
Post subject: | |
actually i cant really tell you, because i dont usually include programs into others, however, if you really want to check just try it and see what happens, check and see if your variables stay the same |
Author: | Rocket [ Thu Jun 08, 2006 5:12 pm ] |
Post subject: | |
all right, well thanks for the help. Snip! Personal comment removed. Please use the Private Message system to talk to other individuals rather than spamming the forum with personal questions. |
Author: | Rocket [ Thu Jun 08, 2006 6:02 pm ] |
Post subject: | |
the include isnt working for me. it cant place it in procedures or if statements, and becasuase i need to be able to choose from b ,c or d from a im not sure what to do |
Author: | Rocket [ Thu Jun 08, 2006 6:28 pm ] |
Post subject: | |
sorry for double post but the other thing is i can include program b from program a, but if i put iclude a in b it wont compile |
Author: | Rocket [ Thu Jun 08, 2006 8:31 pm ] |
Post subject: | |
bluedevils_77 wrote: its called importing and exporting
in program B,C,D hvae unit export (name) hello procedure(name) hello end (name) hello if name was hello then in program A hvae import "hello.tu" then when want it to run (program name , what u save it as).hello sorry for posting again but this is very urgent, could you be a little more clear in those instructions |
Author: | TheOneTrueGod [ Thu Jun 08, 2006 9:08 pm ] |
Post subject: | |
Why are you trying to do this? In order to recieve more specific help, you're going to have to post a more specific question. Give some sample code, or at least describe your program in-depth. |