1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

os: add os.stdout() and os.stderr(), returning os.File, similarly to os.stdin() (#9990)

This commit is contained in:
Leigh McCulloch 2021-05-03 09:00:51 -07:00 committed by GitHub
parent 4ba11b7752
commit 0fa9a648ae
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -146,6 +146,24 @@ pub fn stdin() File {
} }
} }
// stdout - return an os.File for stdout
pub fn stdout() File {
return File{
fd: 1
cfile: C.stdout
is_opened: true
}
}
// stderr - return an os.File for stderr
pub fn stderr() File {
return File{
fd: 2
cfile: C.stderr
is_opened: true
}
}
// **************************** Write ops *************************** // **************************** Write ops ***************************
// write implements the Writer interface. // write implements the Writer interface.
// It returns how many bytes were actually written. // It returns how many bytes were actually written.