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

Username:   Password: 
 RegisterRegister   
 [Tutorial] Using Shell commands in turing
Index -> Programming, Turing -> Turing Tutorials
Goto page 1, 2  Next
View previous topic Printable versionDownload TopicRate TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
ReN3g@de




PostPosted: Tue Mar 09, 2004 10:59 pm   Post subject: [Tutorial] Using Shell commands in turing

You can use Shell commands in Turing and do such things as Restart, Shutdown, etc. LOL!! but be wise these commands could be used for evil things so use this information usefully!

First off here's the syntax:
code:
system ( command : string, var ret : int )


Your Shell command goes in the command : string area
and the return variable goes in the var ret: int area.

For every command run there is an interger that is returned to determine if the command worked properly or if not then what went wrong...

code:
var ret: int
system("cmd",ret)

This program will make the command prompt open

Here are the possible errors (the lines before the numbers are needed, they're negatives):
0 Works properly
-1 Not enough memory to load command.com
-2 Not enough memory to run command
-3 Argument list greater than 128 bytes or environment info
is greater than 32k
-4 Couldn't find command.com
-5 command.com is corrupt
-6 -noshell option is selected, the system procedure is
disallowed

To interpret these errors you could set up an if statement to see whether the execution has worked...

code:
var ret: int
system("cmd",ret)
if ret=-7 then
   put "Command cannot be found"
end if

some thing along these lines will do just fine!

code:
var ret: int
system("shutdown -s -c message-here",ret)

This program will shutdown the computer...
the -s means shutdown you can change it to -r to reboot... but the -c must stau the same!
the message here part is a message that appers... because this form of shutting down makes a message prompt appear counting down 30 seconds till shut down and a message is written below. There cannot be any spaces or the command will not work!

Thats all for today boys and girls hope you liked it!!
Sponsor
Sponsor
Sponsor
sponsor
jonos




PostPosted: Wed Mar 10, 2004 12:38 pm   Post subject: (No subject)

wow, great tutorial. so turing's shell syntax is almost exactly like c++. thanks for the help, though i have a feeling some noobs gonna come and do the shutdown one, hehe.
recneps




PostPosted: Wed Mar 10, 2004 1:43 pm   Post subject: (No subject)

Yeah, this is what i was talking about in some other post in help section, someone wanted to know how to delete, and i said there was one that let you use command prompts (as an alternative Wink) And thats crazy, how does your sig pic work? lol
ReN3g@de




PostPosted: Wed Mar 10, 2004 4:47 pm   Post subject: (No subject)

who mine?
im really not sure lol... i found it on the net and i thot it was pretty cool!
recneps




PostPosted: Thu Mar 11, 2004 4:05 pm   Post subject: (No subject)

Its scary, its like "OMG how does he know my ip?!" And that im using IE (well most ppl do, but still lol)
octopi




PostPosted: Thu Mar 11, 2004 4:15 pm   Post subject: (No subject)

Its pretty simple, I used to have a avatar that would check to see if your computer had a firewall or not.


Basically he enters the html code, which loads an image from the server. But the image is not an image, its a cgi program, this program then gets information about the user from the headers, and then enters that info into an image, and returns the image to the browser.
ReN3g@de




PostPosted: Thu Mar 11, 2004 6:02 pm   Post subject: (No subject)

well there u have it
zylum




PostPosted: Thu Mar 11, 2004 7:45 pm   Post subject: (No subject)

you could also do it using flash and php i think... where the php would figure out the info and then make an xml file and flash would read it and put the text on the image...
Sponsor
Sponsor
Sponsor
sponsor
recneps




PostPosted: Fri Mar 12, 2004 2:29 pm   Post subject: (No subject)

Interesting stuff! Wink
SuperGenius




PostPosted: Mon Mar 29, 2004 7:36 pm   Post subject: (No subject)

About that pic.... it got my os and browser right, but the IP is wrong I think. At least it is way different than what turing told me when i was working with my connect 4 game.
octopi




PostPosted: Mon Mar 29, 2004 8:28 pm   Post subject: (No subject)

Turing will probally tell you the internal network ip address of your system's NIC card, usually 192.168.0.X, or similar, could also be 10.X, or 169.X

When on the internet, you external IP address is given.
SuperGenius




PostPosted: Mon May 17, 2004 4:06 pm   Post subject: (No subject)

octopi wrote:


When on the internet, you external IP address is given.


My connect 4 game uses Net.LocalAdress to give a number which the client types to connect to the host. So if it it the internal ip then my program should work fine within a network, but how do i get it to connect two computers that are not networked?
octopi




PostPosted: Mon May 17, 2004 6:36 pm   Post subject: (No subject)

You dont.....they have to be networked....unless you intend to send data back and forth via carrier pidgeon.
SuperGenius




PostPosted: Mon May 17, 2004 7:30 pm   Post subject: (No subject)

What a rip off.
octopi




PostPosted: Mon May 17, 2004 8:29 pm   Post subject: (No subject)

Just so were both on the same page....


not networked means not connected to the internet, correct?
Display posts from previous:   
   Index -> Programming, Turing -> Turing Tutorials
View previous topic Tell A FriendPrintable versionDownload TopicRate TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

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


Style:  
Search: