2016 Update
This commit is contained in:
parent
948b86eafa
commit
dcf5d15da3
7965 changed files with 139854 additions and 31002 deletions
|
|
@ -1,7 +1,12 @@
|
|||
{{selection|Short Circuit|Console Program Basics}}[[Category:Basic language learning]] [[Category:Streams]] [[Category:Simple]]
|
||||
{{selection|Short Circuit|Console Program Basics}}
|
||||
[[Category:Basic language learning]]
|
||||
[[Category:Streams]]
|
||||
[[Category:Simple]]
|
||||
{{omit from|PARI/GP|No access to streams other than input}}
|
||||
{{omit from|TI-89 BASIC}} <!-- No streams other than user input, not really applicable. -->
|
||||
|
||||
Read from a text stream either word-by-word or line-by-line
|
||||
until the stream runs out of data. <br>
|
||||
;Task:
|
||||
Read from a text stream either word-by-word or line-by-line until the stream runs out of data.
|
||||
|
||||
The stream will have an unknown amount of data on it.
|
||||
<br><br>
|
||||
|
|
|
|||
9
Task/Input-loop/Elena/input-loop-1.elena
Normal file
9
Task/Input-loop/Elena/input-loop-1.elena
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
#import system.
|
||||
#import system'routines.
|
||||
#import system'io.
|
||||
#import extensions'routines.
|
||||
|
||||
#symbol program =
|
||||
[
|
||||
ReaderEnumerator new:("file.txt" file_path textreader) run &each:printingLn.
|
||||
].
|
||||
11
Task/Input-loop/Elena/input-loop-2.elena
Normal file
11
Task/Input-loop/Elena/input-loop-2.elena
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
#import system.
|
||||
#import system'io.
|
||||
|
||||
#symbol program =
|
||||
[
|
||||
#var reader := "file.txt" file_path textreader.
|
||||
#loop (reader available)?
|
||||
[
|
||||
console writeLine:(reader read &literal).
|
||||
].
|
||||
].
|
||||
|
|
@ -1,3 +1,3 @@
|
|||
for pipe("find -iname '*.txt'").lines -> $filename {
|
||||
for run(«find -iname *.txt», :out).out.lines -> $filename {
|
||||
...
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,3 +1,3 @@
|
|||
for pipe("find -iname '*.txt' -print0", :nl«\0»).lines -> $filename {
|
||||
for run(«find -iname *.txt -print0», :nl«\0», :out).out.lines -> $filename {
|
||||
...
|
||||
}
|
||||
|
|
|
|||
12
Task/Input-loop/VBScript/input-loop.vb
Normal file
12
Task/Input-loop/VBScript/input-loop.vb
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
filepath = "SPECIFY PATH TO TEXT FILE HERE"
|
||||
|
||||
Set objFSO = CreateObject("Scripting.FileSystemObject")
|
||||
Set objInFile = objFSO.OpenTextFile(filepath,1,False,0)
|
||||
|
||||
Do Until objInFile.AtEndOfStream
|
||||
line = objInFile.ReadLine
|
||||
WScript.StdOut.WriteLine line
|
||||
Loop
|
||||
|
||||
objInFile.Close
|
||||
Set objFSO = Nothing
|
||||
Loading…
Add table
Add a link
Reference in a new issue