From: Tsuda Kageyu Date: Wed, 19 Feb 2014 14:35:23 +0000 (+0900) Subject: Avoid using sprintf() in tagreader.cpp to fix an MSVC warning. X-Git-Tag: v1.10beta~181^2 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=05e00814145bf9493f6a9a92b8718626cb5d604b;p=taglib Avoid using sprintf() in tagreader.cpp to fix an MSVC warning. --- diff --git a/examples/tagreader.cpp b/examples/tagreader.cpp index cc978eba..ac81be62 100644 --- a/examples/tagreader.cpp +++ b/examples/tagreader.cpp @@ -32,13 +32,6 @@ using namespace std; -TagLib::String formatSeconds(int seconds) -{ - char secondsString[3]; - sprintf(secondsString, "%02i", seconds); - return secondsString; -} - int main(int argc, char *argv[]) { for(int i = 1; i < argc; i++) { @@ -89,7 +82,7 @@ int main(int argc, char *argv[]) cout << "bitrate - " << properties->bitrate() << endl; cout << "sample rate - " << properties->sampleRate() << endl; cout << "channels - " << properties->channels() << endl; - cout << "length - " << minutes << ":" << formatSeconds(seconds) << endl; + cout << "length - " << minutes << ":" << setfill('0') << setw(2) << seconds << endl; } } return 0;