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

Username:   Password: 
 RegisterRegister   
 Text file program
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
Paul




PostPosted: Sun Feb 29, 2004 9:51 am   Post subject: Text file program

This is a school assignment, we just learned how to work with getting info and outputting into text files and stuff. I wasn't paying alot of attention. This program basically gets info from one text file, and puts the info into 3 different files according to the info there. Since I wasn't paying attention, is there anyway to shorten this significantly?


hockey.t
 Description:

Download
 Filename:  hockey.t
 Filesize:  1.51 KB
 Downloaded:  109 Time(s)

Sponsor
Sponsor
Sponsor
sponsor
Delos




PostPosted: Sun Feb 29, 2004 11:33 am   Post subject: (No subject)

Looks good.

How about a little commenting?

For the sake of completeness, you should close your filestreams at the end of the programme.

In this particular prog, it makes no difference, but once you get to longer progs with more files, it is really useful to close any unnecassary streams...
recneps




PostPosted: Sun Feb 29, 2004 11:37 am   Post subject: (No subject)

Thats about as short as i could get it, but im sure others here will compete to have the least lines Smile
Paul




PostPosted: Sun Feb 29, 2004 12:48 pm   Post subject: (No subject)

Delos wrote:

For the sake of completeness, you should close your filestreams at the end of the programme.

You mean like this?

close (input)
close (output)
close (output1)
close (output2)

ok, though I dunno what it does
BlAcK TuRtLe




PostPosted: Sun Feb 29, 2004 3:13 pm   Post subject: (No subject)

My class never learned reading and writing in turing in Gr 10 but we learned it in Java in Gr.11. Just wondering if it runs under the same principle.
shorthair




PostPosted: Sun Feb 29, 2004 3:40 pm   Post subject: (No subject)

if you leave them oppen ,you slow down your programs and you keep them in use , becuase turing keeps it in its cache or in memory ( or somthing i believe ) bcause the stream is still open so it has to keep watching that stream , if you close it after its been written to turing dosent have to worry about it anymore
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  [ 6 Posts ]
Jump to:   


Style:  
Search: