A-M baby
This commit is contained in:
parent
764da6cbbb
commit
db842d013d
19005 changed files with 197040 additions and 7 deletions
3
Task/Hello-world-Standard-error/0DESCRIPTION
Normal file
3
Task/Hello-world-Standard-error/0DESCRIPTION
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
{{selection|Short Circuit|Console Program Basics}}A common practice in computing is to send error messages to a different output stream than [[User Output - text|normal text console messages]]. The normal messages print to what is called "standard output" or "standard out". The error messages print to "standard error". This separation can be used to redirect error messages to a different place than normal messages.
|
||||
|
||||
Show how to print a message to standard error by printing "Goodbye, World!" on that stream.
|
||||
2
Task/Hello-world-Standard-error/1META.yaml
Normal file
2
Task/Hello-world-Standard-error/1META.yaml
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
---
|
||||
note: Basic language learning
|
||||
|
|
@ -0,0 +1 @@
|
|||
echoerr Goodbye, World!
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
main:(
|
||||
put(stand error, ("Goodbye, World!", new line))
|
||||
)
|
||||
|
|
@ -0,0 +1 @@
|
|||
implement main () = fprint (stderr_ref, "Goodbye, World!\n")
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
BEGIN {
|
||||
print "Goodbye, World!"| "cat 1>&2"
|
||||
}
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
BEGIN {
|
||||
print "Goodbye, World!" > "/dev/stderr"
|
||||
}
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
with Ada.Text_IO; use Ada.Text_IO;
|
||||
|
||||
procedure Goodbye_World is
|
||||
begin
|
||||
Put_Line (Standard_Error, "Goodbye, World!");
|
||||
end Goodbye_World;
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
use std
|
||||
eprint "Goodbye, World!"
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
use std
|
||||
eprintf "Goodbye, World!\n"
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
use std
|
||||
fprintf stderr "Goodbye, World!\n"
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
; c:\> autohotkey.exe stderr.ahk 2> error.txt
|
||||
FileAppend, Goodbye`, World!, stderr ; requires AutoHotkey_N
|
||||
|
|
@ -0,0 +1 @@
|
|||
FileAppend, Goodbye`, World!, *
|
||||
|
|
@ -0,0 +1 @@
|
|||
ConsoleWriteError("Goodbye, World!" & @CRLF)
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
10 PRINT #1;"Goodbye, World!"
|
||||
20 PAUSE 5: REM allow time for the user to see the error message
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
STD_ERROR_HANDLE = -12
|
||||
SYS "GetStdHandle", STD_ERROR_HANDLE TO @hfile%(1)
|
||||
PRINT #13, "Goodbye, World!"
|
||||
QUIT
|
||||
|
|
@ -0,0 +1 @@
|
|||
1>&2 echo Goodbye, World!
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
#include <iostream>
|
||||
|
||||
using std::cerr;
|
||||
using std::endl;
|
||||
|
||||
int main () {
|
||||
cerr << "Goodbye, World!" << endl;
|
||||
|
||||
return cerr.bad();
|
||||
}
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
#include <stdio.h>
|
||||
|
||||
int main()
|
||||
{
|
||||
fprintf(stderr, "Goodbye, ");
|
||||
fputs("World!\n", stderr);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -0,0 +1 @@
|
|||
message("Goodbye, World!")
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
program-id. ehello.
|
||||
procedure division.
|
||||
display "Goodbye, world!" upon syserr.
|
||||
stop run.
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
(binding [*out* *err*]
|
||||
(println "Goodbye, world!"))
|
||||
|
|
@ -0,0 +1 @@
|
|||
console.warn "Goodbye, World!"
|
||||
|
|
@ -0,0 +1 @@
|
|||
(format *error-output* "Goodbye, world!~%")
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
import std.stdio;
|
||||
|
||||
void main () {
|
||||
stderr.writeln("Goodbye, World!");
|
||||
}
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
import tango.io.Stdout;
|
||||
|
||||
void main () {
|
||||
Stderr("Goodbye, World!").newline;
|
||||
}
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
program Project1;
|
||||
|
||||
{$APPTYPE CONSOLE}
|
||||
|
||||
begin
|
||||
WriteLn(ErrOutput, 'Goodbye, World!');
|
||||
end.
|
||||
|
|
@ -0,0 +1 @@
|
|||
Console::get_Error()::WriteLine("Goodbye World!")
|
||||
|
|
@ -0,0 +1,16 @@
|
|||
//compile using the new dylan.NET v, 11.2.8.2 or later
|
||||
//use mono to run the compiler
|
||||
#refstdasm mscorlib.dll
|
||||
|
||||
import System
|
||||
|
||||
assembly stderrex exe
|
||||
ver 1.1.0.0
|
||||
|
||||
class public auto ansi Module1
|
||||
|
||||
method public static void main()
|
||||
Console::get_Error()::WriteLine("Goodbye World!")
|
||||
end method
|
||||
|
||||
end class
|
||||
|
|
@ -0,0 +1 @@
|
|||
stderr.println("Goodbye, World!")
|
||||
|
|
@ -0,0 +1 @@
|
|||
io:put_chars(standard_error, "Goodbye, World!\n").
|
||||
|
|
@ -0,0 +1 @@
|
|||
puts(2,"Goodbye, world!\n") -- 2 means output to 'standard error'
|
||||
|
|
@ -0,0 +1 @@
|
|||
error-stream get [ "Goodbye, World! bbl, crashing" print flush ] with-output-stream*
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
class Main
|
||||
{
|
||||
public static Void main ()
|
||||
{
|
||||
Env.cur.err.printLine ("Goodbye, World!")
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
outfile-id
|
||||
stderr to outfile-id
|
||||
." Goodbye, World!" cr
|
||||
to outfile-id
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
program StdErr
|
||||
! Fortran 2003
|
||||
use iso_fortran_env
|
||||
|
||||
! in case there's no module iso_fortran_env ...
|
||||
!integer, parameter :: ERROR_UNIT = 0
|
||||
|
||||
write (ERROR_UNIT, *) "Goodbye, World!"
|
||||
end program StdErr
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
package main
|
||||
func main() { println("Goodbye, World!") }
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
package main
|
||||
import ("fmt"; "os")
|
||||
func main() { fmt.Fprintln(os.Stderr, "Goodbye, World!") }
|
||||
|
|
@ -0,0 +1 @@
|
|||
System.err.println("Goodbye, World!")
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
import System.IO
|
||||
main = hPutStrLn stderr "Goodbye, World!"
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
procedure main()
|
||||
write(&errout, "Goodbye World" )
|
||||
end
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
stderr =: 1!:2&4
|
||||
stderr 'Goodbye, World!'
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
public class Err{
|
||||
public static void main(String[] args){
|
||||
System.err.println("Goodbye, World!");
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1 @@
|
|||
WScript.StdErr.WriteLine("Goodbye, World!");
|
||||
|
|
@ -0,0 +1 @@
|
|||
console.warn("Goodbye, World!")
|
||||
|
|
@ -0,0 +1 @@
|
|||
io.stderr:write("Goodbye, World!\n")
|
||||
|
|
@ -0,0 +1 @@
|
|||
error 'Goodbye, World!'
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
MCSET S4=1
|
||||
MCNOTE Goodbye, World!
|
||||
|
|
@ -0,0 +1 @@
|
|||
Write[Streams["stderr"], "Goodbye, World!"]
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
:- module hello_error.
|
||||
:- interface.
|
||||
|
||||
:- import_module io.
|
||||
:- pred main(io::di, io::uo) is det.
|
||||
|
||||
:- implementation.
|
||||
|
||||
main(!IO) :-
|
||||
io.stderr_stream(Stderr, !IO),
|
||||
io.write_string(Stderr, "Goodbye, World!\n", !IO).
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
errmessage "Error";
|
||||
message "...going on..."; % if the user decides to go on and not to stop
|
||||
% the program because of the error.
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
MODULE HelloErr;
|
||||
IMPORT StdError;
|
||||
|
||||
BEGIN
|
||||
StdError.WriteString('Goodbye, World!');
|
||||
StdError.WriteLn
|
||||
END HelloErr.
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
MODULE Stderr EXPORTS Main;
|
||||
|
||||
IMPORT Wr, Stdio;
|
||||
|
||||
BEGIN
|
||||
Wr.PutText(Stdio.stderr, "Goodbye, World!\n");
|
||||
END Stderr.
|
||||
|
|
@ -0,0 +1 @@
|
|||
fprintf(STDERR, "Goodbye, World!\n");
|
||||
|
|
@ -0,0 +1 @@
|
|||
file_put_contents("php://stderr","Hello World!\n");
|
||||
|
|
@ -0,0 +1 @@
|
|||
warn "Goodbye, World!\n";
|
||||
|
|
@ -0,0 +1 @@
|
|||
print STDERR "Goodbye, World!\n";
|
||||
|
|
@ -0,0 +1 @@
|
|||
(out 2 (prinl "Goodbye, World!"))
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
import sys
|
||||
|
||||
print >> sys.stderr, "Goodbye, World!"
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
import sys
|
||||
|
||||
print("Goodbye, World!", file=sys.stderr)
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
import sys
|
||||
|
||||
sys.stderr.write("Goodbye, World!\n")
|
||||
|
|
@ -0,0 +1 @@
|
|||
cat("Goodbye, World!", file=stderr())
|
||||
|
|
@ -0,0 +1 @@
|
|||
say 'Goodbye, World!'
|
||||
|
|
@ -0,0 +1 @@
|
|||
say "Goodbye, World!"
|
||||
|
|
@ -0,0 +1 @@
|
|||
call lineout ,"Goodbye, World!"
|
||||
|
|
@ -0,0 +1 @@
|
|||
call charout ,"Goodbye, World!"
|
||||
|
|
@ -0,0 +1 @@
|
|||
(eprintf "Goodbye, World!\n")
|
||||
|
|
@ -0,0 +1 @@
|
|||
$stderr.puts "Goodbye, World!"
|
||||
|
|
@ -0,0 +1 @@
|
|||
warn "Goodbye, World!"
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
class MAIN is
|
||||
main is
|
||||
#ERR + "Hello World!\n";
|
||||
end;
|
||||
end;
|
||||
|
|
@ -0,0 +1 @@
|
|||
System.err.println("Goodbye, World!")
|
||||
|
|
@ -0,0 +1 @@
|
|||
Console.err.println("Goodbye, World!")
|
||||
|
|
@ -0,0 +1 @@
|
|||
(error "Goodbye, World!")
|
||||
|
|
@ -0,0 +1 @@
|
|||
puts stderr "Goodbye, World!"
|
||||
Loading…
Add table
Add a link
Reference in a new issue