fork(1) download
  1. #include <iostream>
  2. #include <fstream>
  3.  
  4. using namespace std;
  5.  
  6. int main() {
  7. string location;
  8. size_t file_size;
  9.  
  10. cin >> location >> file_size;
  11.  
  12. fstream write_file( location, ios::out | ios::binary );
  13.  
  14. for( size_t i = 0; i != file_size; ++i )
  15. {
  16. // use write_file.write() to add bytes into your binary file.
  17. // the line below adds empty chars into your file (jut to fill it)
  18. write_file.write( "", 1 );
  19. }
  20.  
  21. write_file.close();
  22. return 0;
  23. }
Success #stdin #stdout 0s 3472KB
stdin
binary.dat 1024
stdout
Standard output is empty