The challenge:
Input text from one file and output it to another. Solution should be a complete, working function.
Note: This is a code-trolling question. Please do not take the question and/or answers seriously. More information here.
The challenge:
Note: This is a code-trolling question. Please do not take the question and/or answers seriously. More information here. |
||||
|
CThe whole point of having multiple programming languages, is that you need to use the right tool for the job.
This is evil because it will read garbage on things like cygwin, is completely chinese for a beginner, will scare him when he realizes it's a call for help and, obviously, because C. | |||||||||||||||||||||
|
shI like the simplicity of this one.
Really only works properly if | |||||||||||||||||||||
|
AutoHotKey
You must first open the files in notepad or some other text editor that makes the window names start with the file names. Then it copies the contents of file1 to the clipboard (literally, using ctrl+c), and pastes it into file2, overwriting anything currently in it, and saves. Solves the problem, but in a very inconvenient and pretty useless fashion. It would probably by easier to just copy and paste manually. | |||||
|
As everyone knows, perl is very good for manipulating files. This code will copy the contents of one file to another, and will do so with extra redundancy for good measure.
To be safe, test this out on a small file at first. Once you are convinced of its correctness you can put it into production for use on very large files without worry. | |||||||||
|
C# In order to achieve this, you must make sure to do several things:
Here's the code:
| |||
|
JavaA lot of people find it useful to attempt to use regular expressions or to evaluate strings in order to copy them from one file to another, however that method of programming is sloppy. First we use Java because the OOP allows more transparency in our code, and secondly we use an interactive interface to receive the data from the first file and write it to the second.
In theory (I haven't tested it) this makes the user manually input the content of the first file (word by word) and then writes it to the second file. This response is a play on the ambiguity of the question as to what it means by "input text from one file," and the crazy variable names (generated randomly) were just for some extra fun. | |||||
|
In four simple steps:
| |||||
|
PerlAntivirus included.
| |||||||||||||||||
|
BASHon terminal #1 with the IP, 192.168.1.2
on terminal #2 with the IP, 192.168.1.3
This will encrypt and send | |||||||||
|
C++This is somewhat based on Shingetsu's answer, but I couldn't resist. It is fully functioning, but no student would submit it to their teacher (I hope). If they are willing to analyze the code, they will be able to solve their problem:
| |||||||||
|