Create a file on magnetic tape: Difference between revisions
Content added Content deleted
Line 183: | Line 183: | ||
% go run tapefile.go -data "Hello World" -gzip | tar -tvzf - |
% go run tapefile.go -data "Hello World" -gzip | tar -tvzf - |
||
-rw-rw---- 0 guest guest 11 11 Aug 13:42 TAPE.FILE</pre> |
-rw-rw---- 0 guest guest 11 11 Aug 13:42 TAPE.FILE</pre> |
||
=={{header|Groovy}}== |
|||
{{trans|Java}} |
|||
<lang groovy>import java.nio.file.Files |
|||
import java.nio.file.Path |
|||
import java.nio.file.Paths |
|||
class CreateFile { |
|||
static void main(String[] args) throws IOException { |
|||
String os = System.getProperty("os.name") |
|||
if (os.contains("Windows")) { |
|||
Path path = Paths.get("tape.file") |
|||
Files.write(path, Collections.singletonList("Hello World!")) |
|||
} else { |
|||
Path path = Paths.get("/dev/tape") |
|||
Files.write(path, Collections.singletonList("Hello World!")) |
|||
} |
|||
} |
|||
}</lang> |
|||
=={{header|Haskell}}== |
=={{header|Haskell}}== |