File input/output: Difference between revisions

From Rosetta Code
Content added Content deleted
Line 18: Line 18:
'''Compiler:''' [[mIRC]]
'''Compiler:''' [[mIRC]]


alias Write2FileAndReadIt {
alias Write2FileAndReadIt {
.write myfilename.txt Goodbye Mike!
.write myfilename.txt Goodbye Mike!
.echo -a Myfilename.txt contains: $read(myfilename.txt,1)
.echo -a Myfilename.txt contains: $read(myfilename.txt,1)
}
}


==[[UNIX Shell]]==
==[[UNIX Shell]]==

Revision as of 19:35, 15 January 2007

Task
File input/output
You are encouraged to solve this task according to the task description, using any language you may know.

In this task, the job is to create a file called "output.txt", and place in it the contents of the file "input.txt".

Perl

Interpreter: Perl 5.8.8

#!/usr/bin/perl -w

open INPUT, "<input.txt";
open OUTPUT, ">output.txt";

while ( <INPUT> ) {
  print OUTPUT $_;
}

mIRC

Compiler: mIRC

 alias Write2FileAndReadIt {
 .write myfilename.txt Goodbye Mike!
 .echo -a Myfilename.txt contains: $read(myfilename.txt,1)
 }

UNIX Shell

Interpreter: Bourne Again SHell Operating System: UNIX

#!/usr/bin/bash

cat input.txt > output.txt