2015-01-01から1年間の記事一覧

C#で簡単な画像のトリミングをやってみた

C#

引数で指定された画像をトリミングする using System.Drawing; namespace TrimImage { class Program { static void Main(string[] args) { string srcFile = args[0]; int x = int.Parse(args[1]); int y = int.Parse(args[2]); int width = int.Parse(args…

C++でファイルサイズ取得

C++でファイルサイズを取得する // for win32api #include <Windows.h> // for ifstream #include <fstream> // for stat #include <sys/types.h> #include <sys/stat.h> int main(int argc, char* argv[]) { const char* filepath = "C:\\Windows\\Media\\Windows Shutdown.wav"; // for win32api HANDLE </sys/stat.h></sys/types.h></fstream></windows.h>…

C++で簡単なロガーを考えてみた

コードを見ればわかるはず #include <stdarg.h> #include <string> #include <sstream> #include <fstream> class LogLevel { public: enum type { Info= 1, Debug, Warn, Error, }; static std::string ToString(LogLevel::type logLevel) { switch (logLevel) { case LogLevel::Info: return "I</fstream></sstream></string></stdarg.h>…