| 169 | |
| 170 | |
| 171 | std::ostream *createFile(std::string const& name, bool asBinary) |
| 172 | { |
| 173 | std::string vsi_name(name); |
| 174 | if (isStdout(name)) |
| 175 | vsi_name = "/vsistdout/"; |
| 176 | |
| 177 | std::ios::openmode mode = std::ios::out; |
| 178 | if (asBinary) |
| 179 | mode |= std::ios::binary; |
| 180 | |
| 181 | VSI::VSIOStream *ofs = new Utils::ClassicLocaleStream<VSI::VSIOStream>(vsi_name, mode); |
| 182 | if (!ofs->good()) |
| 183 | { |
| 184 | delete ofs; |
| 185 | return nullptr; |
| 186 | } |
| 187 | return ofs; |
| 188 | } |
| 189 | |
| 190 | |
| 191 | std::ostream *openExisting(const std::string& name, bool asBinary) |