lmi-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[lmi-commits] [lmi] master 6ca9f20 1/6: Pad names of extracted table fil


From: Greg Chicares
Subject: [lmi-commits] [lmi] master 6ca9f20 1/6: Pad names of extracted table files with zeros
Date: Mon, 5 Dec 2016 06:55:44 +0000 (UTC)

branch: master
commit 6ca9f206828b815d521da41f02bb5866140b73cc
Author: Gregory W. Chicares <address@hidden>
Commit: Gregory W. Chicares <address@hidden>

    Pad names of extracted table files with zeros
    
    Padded names sort better.
    
    A width of five characters allows for 99999 tables, which is plenty;
    calculate_and_display_crcs() and list_tables() already use this width.
---
 rate_table_tool.cpp |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/rate_table_tool.cpp b/rate_table_tool.cpp
index 0fead5d..f0088d8 100644
--- a/rate_table_tool.cpp
+++ b/rate_table_tool.cpp
@@ -175,7 +175,7 @@ void delete_table
 std::string do_save_as_text_file(table const& t)
 {
     std::ostringstream oss;
-    oss << t.number() << ".txt";
+    oss << std::setfill('0') << std::setw(5) << t.number() << ".txt";
     std::string const filename = oss.str();
     t.save_as_text(filename);
     return filename;
@@ -433,7 +433,7 @@ int try_main(int argc, char* argv[])
         {"crc"         ,NO_ARG   ,0 ,'c' ,0 ,"show CRCs of all tables"},
         {"list"        ,NO_ARG   ,0 ,'t' ,0 ,"list all tables"},
         {"merge=PATH"  ,REQD_ARG ,0 ,'m' ,0 ,"merge PATH (file or dir) into 
database"},
-        {"extract=n"   ,REQD_ARG ,0 ,'e' ,0 ,"extract table #n into n.txt"},
+        {"extract=n"   ,REQD_ARG ,0 ,'e' ,0 ,"extract table #n into 
0000n.txt"},
         {"extract-all" ,NO_ARG   ,0 ,'x' ,0 ,"extract all tables to txt 
files"},
         {"rename=FILE" ,REQD_ARG ,0 ,'r' ,0 ,"rename tables from FILE"},
         {"verify"      ,NO_ARG   ,0 ,'v' ,0 ,"verify integrity of all tables"},



reply via email to

[Prev in Thread] Current Thread [Next in Thread]