fork(2) download
  1. void
  2. cppshell::stream::to_ostream(
  3. cppshell::stream::object &_stream,
  4. std::ostream &_ostream)
  5. {
  6. std::size_t const buffer_size = 1024u;
  7. std::array<char,buffer_size> buffer;
  8.  
  9. while(
  10. ssize_t const read_bytes =
  11. ::read(
  12. _stream.fd(),
  13. buffer.data(),
  14. buffer.size()))
  15. {
  16. cppshell::check_unix_command_error(
  17. "read",
  18. static_cast<int>(
  19. read_bytes));
  20.  
  21. if(!
  22. _ostream.write(
  23. buffer.data(),
  24. static_cast<std::streamsize>(
  25. read_bytes)))
  26. throw
  27. cppshell::exception{
  28. std::string{
  29. "to_ostream failed: ostream::write failed"}};
  30. }
  31. }
  32.  
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp:2:1: error: 'cppshell' has not been declared
 cppshell::stream::to_ostream(
 ^
prog.cpp:3:2: error: variable or field 'to_ostream' declared void
  cppshell::stream::object &_stream,
  ^
prog.cpp:3:2: error: 'cppshell' has not been declared
prog.cpp:3:28: error: '_stream' was not declared in this scope
  cppshell::stream::object &_stream,
                            ^
prog.cpp:4:2: error: 'ostream' is not a member of 'std'
  std::ostream &_ostream)
  ^
prog.cpp:4:16: error: '_ostream' was not declared in this scope
  std::ostream &_ostream)
                ^
stdout
Standard output is empty