I'm trying to make a command line tool for OS X with Xcode 6 and the new Swift language. How can I send output to stderr? Is this done with println?
Use the fprintf Function to Print to stderr in C The standard I/O library in C provides three text streams that are opened implicitly when the program is started on the system. These streams are, standard input ( stdin ) - used for reading input. standard output ( stdout ) - used for writing output.
You use print() in Swift to print a string of text to the Console, or standard output. It's super useful for debugging and finding out what's going on in your code.
For Swift 4.x:
import Darwin fputs("hello from libc\n", stderr)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With