Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 Calling on other programs
Index -> Programming, Turing -> Turing Help
Goto page 1, 2  Next
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
Rocket




PostPosted: 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
Sponsor
Sponsor
Sponsor
sponsor
Cervantes




PostPosted: Tue Jun 06, 2006 6:23 pm   Post subject: (No subject)

Check out "include".
bluedevils_77




PostPosted: Tue Jun 06, 2006 7:38 pm   Post subject: (No 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
HellblazerX




PostPosted: Tue Jun 06, 2006 8:30 pm   Post subject: (No 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.
Rocket




PostPosted: Tue Jun 06, 2006 9:25 pm   Post subject: (No subject)

no blue devil did what i want i think, plus if i use units, im gonna get super marks! thanks dude
TheOneTrueGod




PostPosted: Tue Jun 06, 2006 9:29 pm   Post subject: (No 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.
Rocket




PostPosted: Tue Jun 06, 2006 9:32 pm   Post subject: (No 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
Clayton




PostPosted: Tue Jun 06, 2006 9:47 pm   Post subject: (No 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 Very Happy
Sponsor
Sponsor
Sponsor
sponsor
bluedevils_77




PostPosted: Wed Jun 07, 2006 7:57 pm   Post subject: (No subject)

first of all whats an include

and second u can import many other .tu files in other turing programs
Clayton




PostPosted: Wed Jun 07, 2006 8:01 pm   Post subject: (No 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)

Turing:

inclue test.t


that simple Very Happy
bluedevils_77




PostPosted: Wed Jun 07, 2006 8:04 pm   Post subject: (No subject)

first of all whats an include

and second u can import many other .tu files in other turing programs
Clayton




PostPosted: Wed Jun 07, 2006 8:19 pm   Post subject: (No 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
Rocket




PostPosted: Wed Jun 07, 2006 9:44 pm   Post subject: (No 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

code:
%this program is called A.t

proc runB

include B.t

end runB


code:
%and then progrma B would look like this

proc runA

include A.t

end runA

and this will all stay in te same window
Clayton




PostPosted: Wed Jun 07, 2006 10:02 pm   Post subject: (No 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 Very Happy
Rocket




PostPosted: Thu Jun 08, 2006 2:02 pm   Post subject: (No subject)

and then if a was called again the varables wouldn't be screwed up?
Display posts from previous:   
   Index -> Programming, Turing -> Turing Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 2  [ 21 Posts ]
Goto page 1, 2  Next
Jump to:   


Style:  
Search: