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

Username:   Password: 
 RegisterRegister   
 Databases?
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
Palaflax




PostPosted: Tue May 30, 2006 8:46 pm   Post subject: Databases?

Well i've been kind of puzzled.

Is there anyway to make turing store information, such as passwords, permanentally? For example keeping a total on how much items a store has sold since it's opened. Or even programming an administration center that will hold it's own password. Likewise for games. In short, can turing "store" information, and if so, how?


Thank you.
Sponsor
Sponsor
Sponsor
sponsor
LegendsEnd




PostPosted: Tue May 30, 2006 8:55 pm   Post subject: (No subject)

You can store information by creating data files. Here's a very crude example:

code:

var file : int
open : file, "data.txt", put
put : file, "HI"
close (file)


You declare a variable to identify the filestream essentially, then you open that filestream, select the file to open, if there is none it will create it. Then what you want to do with the file, you want to put info into it, so you put 'put' afterwards. If you wanted to obtain information you can also add a comma after put, and put 'get', which will allow you access to retrieve information. Then you use the put : syntax, to choose which stream you went to put your data into. When you're done you close the stream with the close statement. To get data you can use the get : syntax. This is just a very very basic outline of it, though it should be enough in most cases. CompSci has various tutorials on this subject so a search through the tutorials section will probably land you a tutorial on this subject.
Palaflax




PostPosted: Thu Jun 01, 2006 9:06 am   Post subject: (No subject)

Well it's okay... but it resets with the counting variable. Is there anyway to store it for an extremely long term time?
Clayton




PostPosted: Thu Jun 01, 2006 11:37 am   Post subject: (No subject)

if you need to keep the counting variable too, just send that to a file as well, check up on the tutorial on file I/O in the Turing Walkthrough to get the complete run-through of it
Palaflax




PostPosted: Fri Jun 02, 2006 2:33 pm   Post subject: (No subject)

Well I couldn't really find any database programs but one that had a "record" function which i didn't really understand XD.
Cervantes




PostPosted: Fri Jun 02, 2006 3:35 pm   Post subject: (No subject)

If you don't understand what "record"s are, go to the Turing Walkthrough and find the link to the records and types tutorial. Give that a read. You also could read the Turing Help manual entry under "record" and under "type".
Palaflax




PostPosted: Fri Jun 02, 2006 6:36 pm   Post subject: (No subject)

Okay so it made more sense that second time. Only thing is I can't really figure out how a record would help with a database, since it is just about the same as declaring a variable. I'm so confused Question Question
Palaflax




PostPosted: Fri Jun 02, 2006 6:50 pm   Post subject: (No subject)

Okay so basically I want it to be able to store passwords and such for long term, without variables being reset. How?
Sponsor
Sponsor
Sponsor
sponsor
Palaflax




PostPosted: Fri Jun 02, 2006 7:13 pm   Post subject: (No subject)

w0000000t!!!

I got it to work Laughing Laughing Laughing
Cervantes




PostPosted: Fri Jun 02, 2006 8:37 pm   Post subject: (No subject)

Nice.

A variable of a user-defined type (using 'type', or anonymously defined using 'record') is just like a variable, you're right. However, it is different in the values that it stores. Rather than being limited to storing a single integer or a single string, it can store two integers and one string, if that's what you want. It essentially allows you to give one variable a whole lot more 'sub-variables', thereby organizing your data into a pseudo-object. I say 'pseudo' because to make it a real object you'd have to use classes.
Palaflax




PostPosted: Fri Jun 02, 2006 9:53 pm   Post subject: (No subject)

thanks for you help Smile
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 1  [ 11 Posts ]
Jump to:   


Style:  
Search: