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

Username:   Password: 
 RegisterRegister   
 How to open a ".txt" document in the Turing Execution Window.
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
nikoudov




PostPosted: Tue Jan 16, 2007 9:55 am   Post subject: How to open a ".txt" document in the Turing Execution Window.

You might ask your self this question...

How do I open and view a .txt (text) document?

Okay, so... if you are in a hurry and quickly in-need of a way to open and read a text document without exploring the Tutorials and understanding how it works, you are at the right link.




Here is the Turing Code:


Turing:

setscreen ("text") 
    % Variables needed to open the ".txt" document.
    var stream : int
    var Line : string

    % This procedure opens the file (The file is located in the same directory as this program).
    open : stream, "NameOfFile.txt", get

% Displays every line in the ".txt" document
    loop
        exit when eof (stream)
        get : stream, Line : *
        put Line
    end loop

% Closed the file
    close : stream[/i]



NOTE: make sure that the above code is not in a "loop" or "for" statement or else the file will not be displayed.

Cervantes added syntax tags



OpenTextFile.t
 Description:
This is the program that will open, read, and display the ".txt" document.
- Make sure to re-name the "NameOfFile.txt" line in the turing code according to the file you are trying to view.

Download
 Filename:  OpenTextFile.t
 Filesize:  472 Bytes
 Downloaded:  124 Time(s)

Sponsor
Sponsor
Sponsor
sponsor
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  [ 1 Posts ]
Jump to:   


Style:  
Search: