@@ -188,18 +188,21 @@ static void uniq_u(const std::filesystem::path& infile, std::filesystem::path& o
188188 char *prevfield, *thisfield;
189189 size_t prevlen, thislen;
190190 int match_count = 0 ;
191+ std::string tmp;
191192
192- FILE *istream = std::fopen (infile.c_str (), " r" );
193+ tmp = infile.string ();
194+ FILE *istream = std::fopen (tmp.c_str (), " r" );
193195 if (istream == nullptr )
194196 {
195- print_stderr (" uniq-u: Error while opening {}\n " , infile );
197+ print_stderr (" uniq-u: Error while opening {}\n " , tmp );
196198 error (" fopen" , " File open error." );
197199 }
198200
199- FILE *ostream = std::fopen (outfile.c_str (), " w" );
201+ tmp = outfile.string ();
202+ FILE *ostream = std::fopen (tmp.c_str (), " w" );
200203 if (ostream == nullptr )
201204 {
202- print_stderr (" uniq-u: Error while opening {}\n " , outfile );
205+ print_stderr (" uniq-u: Error while opening {}\n " , tmp );
203206 error (" fopen" , " File open error." );
204207 }
205208
@@ -254,13 +257,15 @@ static void uniq_u(const std::filesystem::path& infile, std::filesystem::path& o
254257closefiles:
255258 if (std::ferror (istream) || std::fclose (istream) == EOF)
256259 {
257- print_stderr (" uniq-u: Error while reading {}\n " , infile);
260+ tmp = infile.string ();
261+ print_stderr (" uniq-u: Error while reading {}\n " , tmp);
258262 error (" fclose" , " I/O Error." );
259263 }
260264
261265 if (ferror (ostream) || fclose (ostream) == EOF)
262266 {
263- print_stderr (" uniq-u: Error while writing {}\n " , outfile);
267+ tmp = outfile.string ();
268+ print_stderr (" uniq-u: Error while writing {}\n " , tmp);
264269 error (" fclose" , " I/O Error." );
265270 }
266271
0 commit comments