How to open a ".txt" document in the Turing Execution Window.
Author |
Message |
nikoudov
|
Posted: 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
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
|
|
|
|
|