Here is my solution: http://pastie.org/419470
It should work in both Windows and Linux. (i set it to handle the different line endings, and it worked on my tests for both systems) If you give it bad data, it will act up, I didn't code for exceptions (ie giving chars instead of numbers), I did have it check that the correct number of argments exist, though.
Compile it and run it from the command line or terminal like this:
cut input.txt output.txt characters 10 15
This will call the program (cut) have it open the file "input.txt" read characters 10 through 15 (inclusive) and print them out to the file "output.txt"
Or you could do like this
cut input.txt output.txt fileds 2 3
This will print fields 2 through 3 inclusive to the output file.
In reality, it tells the difference between characters and fields by just checking the first character of the third input. If it begins with a 'c' then it assumes characters. Otherwise, it assumes fields. So you could shorten these to
cut input.txt output.txt c 10 15
cut input.txt output.txt f 2 3
To print a single character or field, use the same begin and ending index.
All indexes begin at 1. So the first character is character 1, and the first field is field 1.