Is a separator character required to parse a string using std::get_time? I can't find a reference to say that it is. I'm trying to parse an ISO date/time string such as "20140105T123456" - for example:
For example,
#include <iostream>
#include <sstream>
#include <locale>
#include <iomanip>
#include <ctime>
int main(int argc, char* argv[])
{
std::tm t = { 0 };
// fails
std::istringstream ss("20141105T123456");
ss >> std::get_time(&t, "%Y%m%dT%H%M%S");
// works
//std::istringstream ss("2014 11 05 T 12 34 56");
//ss >> std::get_time(&t, "%Y %m %d T %H %M %S");
std::ostringstream os;
std::cout << std::put_time(&t, "%c") << std::endl;
}
I'm using Visual Studio 2013. I tried to build on Linux but the latest version of GCC I have is 4.7.3 which doesn't appear to support get_time yet.
Silly mistake on my part or are separators required?