C++ : Convert fileparts Matlab Code

If you use Matlab, we can get pathname, filename and extension from input full string path. How if we want extract dirname, filename and extension in C++ ? I want to get pathdir, filename and extension from input string. I have created a simple code how to extract path, filename and extension from fullpath string [...]

C++ : Split String By Separator

This code show a simple method how to split string in C++. The output from this code split string in C++ are in vector<string>. Please check Split String in C++ below : #include <vector> #include <iostream> #include <string> using namespace std; vector<string> splitString(string str, string separator) { vector<string> result; string tmp; int start, end; result.clear(); [...]

C/C++ : datenum code

Matlab have a function to convert string of date to double number. This double number represent preset day from (January 0, 0000). This function name is “datenum”. I want to use this function in C/C++.  I have research this function and create a simple code how to use datenum in our C/C++ code (convert datenum [...]

C/C++ : Get Current Time

Using Matlab, we can get the current date and time using “now” command.  Example, using Matlab  we can use below command : >> datestr(now,’dd-mm-yyyy HH:MM:SS.FFF’) ans = 21-10-2014 13:41:58.666 How if we want to get current time using C/C++ with the result like Matlab ? We can use “localtime” to get date and time in [...]