| 6 | namespace das { |
| 7 | |
| 8 | inline bool saveToFile ( TextPrinter &tout, const string_view & fname, const string_view & str, bool quiet = false ) { |
| 9 | FILE * f = fopen ( fname.data(), "wb" ); |
| 10 | if ( !f ) { |
| 11 | tout << "can't open " << fname.data() << "\n"; |
| 12 | return false; |
| 13 | } |
| 14 | if ( !quiet ) { |
| 15 | tout << "saving to " << fname.data() << "\n"; |
| 16 | } |
| 17 | fwrite ( str.data(), str.length(), 1, f ); |
| 18 | fclose ( f ); |
| 19 | return true; |
| 20 | } |
| 21 | |
| 22 | /** |
| 23 | * Shortcut to wrap code into namespace |
no test coverage detected