@@ -1010,16 +1010,6 @@ pub fn FILE_reader(f: *libc::FILE, cleanup: bool) -> @Reader {
1010
1010
// top-level functions that take a reader, or a set of default methods on
1011
1011
// reader (which can then be called reader)
1012
1012
1013
- /**
1014
- * Gives a `Reader` that allows you to read values from standard input.
1015
- *
1016
- * # Examples
1017
- * ~~~
1018
- * let stdin = core::io::stdin();
1019
- * let line = stdin.read_line();
1020
- * core::io::print(line);
1021
- * ~~~
1022
- */
1023
1013
pub fn stdin ( ) -> @Reader {
1024
1014
unsafe {
1025
1015
@rustrt:: rust_get_stdin ( ) as @Reader
@@ -1571,13 +1561,57 @@ pub fn buffered_file_writer(path: &Path) -> Result<@Writer, ~str> {
1571
1561
// FIXME (#2004) it would be great if this could be a const
1572
1562
// FIXME (#2004) why are these different from the way stdin() is
1573
1563
// implemented?
1564
+
1565
+
1566
+ /**
1567
+ * Gives a `Writer` which allows you to write to the standard output.
1568
+ *
1569
+ * # Examples
1570
+ * ~~~
1571
+ * let stdout = core::io::stdout();
1572
+ * stdout.write_str("hello\n " ) ;
1573
+ * ~~~
1574
+ * /
1574
1575
pub fn stdout ( ) -> @Writer { fd_writer ( libc:: STDOUT_FILENO as c_int , false ) }
1576
+
1577
+ /**
1578
+ * Gives a `Writer` which allows you to write to standard error.
1579
+ *
1580
+ * # Examples
1581
+ * ~~~
1582
+ * let stderr = core::io::stderr();
1583
+ * stderr.write_str("hello\n");
1584
+ * ~~~
1585
+ */
1575
1586
pub fn stderr ( ) -> @Writer { fd_writer ( libc:: STDERR_FILENO as c_int , false ) }
1576
1587
1588
+ /**
1589
+ * Prints a string to standard output.
1590
+ *
1591
+ * This string will not have an implicit newline at the end. If you want
1592
+ * an implicit newline, please see `println`.
1593
+ *
1594
+ * # Examples
1595
+ * ~~~
1596
+ * // print is imported into the prelude, and so is always available.
1597
+ * print("hello");
1598
+ * ~~~
1599
+ */
1577
1600
pub fn print ( s : & str ) {
1578
1601
stdout ( ) . write_str ( s) ;
1579
1602
}
1580
1603
1604
+ /**
1605
+ * Prints a string to standard output, followed by a newline.
1606
+ *
1607
+ * If you do not want an implicit newline, please see `print`.
1608
+ *
1609
+ * # Examples
1610
+ * ~~~
1611
+ * // println is imported into the prelude, and so is always available.
1612
+ * println("hello");
1613
+ * ~~~
1614
+ */
1581
1615
pub fn println ( s : & str ) {
1582
1616
stdout ( ) . write_line ( s) ;
1583
1617
}
0 commit comments