O'Reilly logo

Dart: Scalable Application Development by Ivo Balbaert, Sergey Akopkokhyants, Davy Mitchell

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Concatenating files

Let's suppose that we have a number of text files we want to glue together in one big file. This recipe with code in the project concat_files shows you how this can be done.

How to do it...

The program is launched from the command line in the bin folder (or in Dart Editor with a Managed Launch with Script arguments file1.txt file2.txt file.txt) as dart co ncat.dart file1.txt file2.txt file.txt, where file1.txt and file2.txt are the files to be concatenated (there can be two or more files) into file.txt. The following is the code to perform this:

import 'dart:io'; import 'package:args/args.dart'; ArgResults argResults; File output; void main(List<String> arguments) { final parser = new ArgParser(); argResults = parser.parse(arguments); ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required