index | submit | rank | book

erro – Standard error output

Write a program that prints “This is stdout.” to the standard output device and prints “This is stderr.” to the error output device.

$ ./erro
This is stdout.
This is stderr.

Input and output

No input should be read.

Standard output should contain a single line with “This is stdout.”. Error output should contain a single line with “This is stderr.”.

Scoring

Hints

On the shell, you can redirect stdout and stderr to a file by using > and 2>:

$ ./erro >out.txt
This is stderr.
$ ./erro 2>err.txt
This is stdout.
$ ./erro >out.txt 2>err.txt

Use this to double-check your solution.

try first: file-write

try also: hello-cmd

try next: errxit

index | submit | rank | book

Copyright © 2020-2021 Rudy Matela
All rights reserved