#4436·fmt

在 Windows 上由于编码错误导致打印错误代码 `:s` 失败

作者: trim21创建于 2025年5月3日更新于 2025年5月10日

============================================================================

包括 < 例外 >

包括“ 文件系统 ”

包括 " 电流 "

#包括"fmt/ostream.h" #包括"fmt/std.h"

命名空间 fs = std:: file system;

英寸主( ) { cons:从{'/none1/a'}到{'/none2/b'}的路径;

尝试{ fs: 复制 文件(从,到); } 接上( fs: filesystem error const &ex) { std:: cout qq "( ):" qq ex. () qq 'n' “ path1( ): ” ex. path1( ) “\ n” “ path2( ): ” “ ex. path2( ) ” qq"code (. value ():)" qq ex.code (. value () qq"\n" qq "code (. message ():)" qq ex.code (. message () "\n" qq "code (. special (:)" ex.code (. special (.) special (. ) name (.) qq"\n";

尝试{ fmt:: println ("{: s}", ex.code ()); ; ). { 捕获(std: 例外 & e){ fmt:: println ("fmt error: {}"), e. what ()); {\fn黑体\fs22\bord1\shad0\3ahbe\4ah00\fscx67\fscy66\2chffffff\3ch808080}你觉得呢? {\fn黑体\fs22\bord1\shad0\3ahbe\4ah00\fscx67\fscy66\2chffffff\3ch808080}你觉得呢?

fmt:: println ("exit") ; 2. 返回 0; {\fn黑体\fs22\bord1\shad0\3ahbe\4ah00\fscx67\fscy66\2chffffff\3ch808080}你觉得呢?